|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 670ABC 于 2022-1-20 15:13 编辑
求助
import openpyxl
>>> wb = openpyxl.Workbook()
>>> wb.save("demo.xlsx")
为什么我在写这段代码时运行会出现Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
wb.save("demo.xlsx")
File "C:\Users\Daniel\AppData\Roaming\Python\Python38\site-packages\openpyxl\workbook\workbook.py", line 407, in save
save_workbook(self, filename)
File "C:\Users\Daniel\AppData\Roaming\Python\Python38\site-packages\openpyxl\writer\excel.py", line 291, in save_workbook
archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True)
File "C:\Program Files\Python38\lib\zipfile.py", line 1251, in __init__
self.fp = io.open(file, filemode)
PermissionError: [Errno 13] Permission denied: 'demo.xlsx'
的错误?每次都是这样,不知道该如何下手,提示拒绝访问
球球大佬帮帮我
错误的提示是保存文件的权限不够,这是windows的事,与python,与你的程序无关。
改成非C盘试试。比如:
wb.save("d:\\demo.xlsx")
|
|