python-docx

此生再无相见时 提交于 2019-12-20 11:58:12

首先安装包 pip3 install python -docx

from docx import Document
#创建docx对象
document = docx.Document(path)
#遍历段落文本
for paragraph in document.paragraphs:
	print(paragraph.text)
#删除段落信息
document.paragraphs[i].clear()
#添加段落信息
document.paragraphs[i].add_run('内容')
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!