|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from docx import Document
file = Document('ABC.docx')
file.add_paragraph('我是正文 奈克瑟斯')
file.save('练习4.docx')
报错:Traceback (most recent call last):
File "C:\Users\Administrator\Word自动化\导入.py", line 7, in <module>
file.save('练习4.docx')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\docx\document.py", line 135, in save
self._part.save(path_or_stream)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\docx\parts\document.py", line 111, in save
self.package.save(path_or_stream)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\docx\opc\package.py", line 172, in save
PackageWriter.write(pkg_file, self.rels, self.parts)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\docx\opc\pkgwriter.py", line 32, in write
phys_writer = PhysPkgWriter(pkg_file)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\docx\opc\phys_pkg.py", line 141, in __init__
self._zipf = ZipFile(pkg_file, 'w', compression=ZIP_DEFLATED)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\zipfile.py", line 1204, in __init__
self.fp = io.open(file, filemode)
PermissionError: [Errno 13] Permission denied: '练习4.docx'
|
|