摘要:1. 删除文件: def delete_file(file_name): if os.path.exists(file_name): os.remove(file_name) print('临时文件 %s 已被删除' % file_name) else: pass print('要删除的临时文件 %
阅读全文
posted @ 2022-01-17 10:08
01 2022 档案
摘要:1. 删除文件: def delete_file(file_name): if os.path.exists(file_name): os.remove(file_name) print('临时文件 %s 已被删除' % file_name) else: pass print('要删除的临时文件 %
阅读全文
posted @ 2022-01-17 10:08
摘要:来自:https://www.cnblogs.com/Lival/category/674522.html,感谢作者。 一、try...except 有时候我们写程序的时候,会出现一些错误或异常,导致程序终止。例如,做除法时,除数为0,会引起一个ZeroDivisionError 例子: 1 2 3
阅读全文
posted @ 2022-01-06 09:59
摘要:新建Excel表格 新建Excel表格,默认有一个名为 Sheet 的表格,如下: 复制 123456 from openpyxl import Workbookwb = Workbook() #创建文件对象ws = wb.active #获取默认sheetwb.save("sample.xlsx"
阅读全文
posted @ 2022-01-01 22:26
|
||