FengHL 发表于 2021-6-9 16:50:13

Python保存成Excel出现错误?

出现了错误
Traceback (most recent call last):
File "<pyshell#39>", line 1, in <module>
    wb.save(r"C:\Users\Administrator\Desktop\TOP250.xlsx")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\openpyxl\workbook\workbook.py", line 407, in save
    save_workbook(self, filename)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\openpyxl\writer\excel.py", line 291, in save_workbook
    archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 1251, in __init__
    self.fp = io.open(file, filemode)
PermissionError: Permission denied: 'C:\\Users\\Administrator\\Desktop\\TOP250.xlsx'

Twilight6 发表于 2021-6-9 17:03:01


你不能打开 xlsx 文件后执行代码,将后台已经打开的 Excel 文件退出重新执行代码
页: [1]
查看完整版本: Python保存成Excel出现错误?