1.Installing:pip install python-docx,值得注意的是需要先安装lxml才行。
2.Dependencies:Python 2.6, 2.7, 3.3, or 3.4,lxml >= 2.3.2
3.Start:
from docx import Document
document = Document()
document.add_heading('The REAL meaning of the universe')
document.add_heading('The role of dolphins', level=2)
document.save('test.docx')