"遇到这种情况应该怎么解决呢? [图片]"
遇到这种情况应该怎么解决呢?
回帖内容已被屏蔽。
😆 坐等 1 楼大神回复
我之前看过这个,试了不管用 😂
看下这个 https://blog.csdn.net/weixin_42704981/article/details/107710518
path = r’C:/RPA_SHANGHAI/ 舱单录入 /‘+self.sheetname[sheet]+’/‘+tmpname+’/input/’print(path)name_list = os.listdir(path)print(name_list)for name in name_list:if name[name.rfind(‘.’)+1:]==‘xls’:print(name)fname = os.path.join(path,name)print(fname)if not os.path.exists(name+‘x’):print(‘meiyou xlsx’)excel = win32com.client.Dispatch(‘Excel.Application’)wb = excel.Workbooks.Open(fname)wb.Close()wb.SaveAs(os.rename(fname,fname+“x”),FileFormat=51)print(fname)wb = excel.Workbooks.Open(fname)wb.Close()excel.Application.Quit()os.remove(fname)new_list = os.listdir(path)print(new_list)
方便看下 具体代码么?
回帖内容已被屏蔽。
😆 坐等 1 楼大神回复
我之前看过这个,试了不管用 😂
看下这个 https://blog.csdn.net/weixin_42704981/article/details/107710518
path = r’C:/RPA_SHANGHAI/ 舱单录入 /‘+self.sheetname[sheet]+’/‘+tmpname+’/input/’
print(path)
name_list = os.listdir(path)
print(name_list)
for name in name_list:
if name[name.rfind(‘.’)+1:]==‘xls’:
print(name)
fname = os.path.join(path,name)
print(fname)
if not os.path.exists(name+‘x’):
print(‘meiyou xlsx’)
excel = win32com.client.Dispatch(‘Excel.Application’)
wb = excel.Workbooks.Open(fname)
wb.Close()
wb.SaveAs(os.rename(fname,fname+“x”),FileFormat=51)
print(fname)
wb = excel.Workbooks.Open(fname)
wb.Close()
excel.Application.Quit()
os.remove(fname)
new_list = os.listdir(path)
print(new_list)
方便看下 具体代码么?