我正在像这样用Python编写文件:
result = br.response()
html=result.read()
f = open('s.txt','wb')
f.write(html)
contents = open("s.txt","r")
with open("s.html", "w") as e:
for lines in contents.readlines():
e.write(lines + "\n")
此文件保存在C:\ Users \ XX \ Anaconda3中,每当我运行它时,都会出现以下错误:
File "c:\users\atharva\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\atharva\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\ATHARVA\Anaconda3\Scripts\iitbbscli.exe\__main__.py", line 9, in <module>
File "c:\users\atharva\anaconda3\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\users\atharva\anaconda3\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\users\atharva\anaconda3\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\atharva\anaconda3\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\atharva\anaconda3\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\users\atharva\anaconda3\lib\site-packages\iitbbscli\app.py", line 82, in attendance
f = open('s.txt','wb')
PermissionError: [Errno 13] Permission denied: 's.txt'
如何克服此错误?
答案 0 :(得分:0)
具有管理权限运行IDE