python-docx
首先安装包 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 ( '内容' ) 来源: CSDN 作者: YZBPXX 链接: https://blog.csdn.net/weixin_44195175/article/details/103337909