python-docx
python-docx是python用于编辑生成word文档的一个库
Python DocX目前是Python OpenXML的一部分,你可以用它打开Word 2007及以后的文档。
详细文档请见:https://python-docx.readthedocs.org/en/latest/
创建一个word文档
from docx import Document
from docx.shared import Inches
document = Document()
document.add_heading('Document Title', 0)
p = document.add_paragraph('A plain paragraph having some ')
p.add_run('bold').bold = True
p.add_run(' and some ')
p.