.docx的,需要安装一个第三方包,pip install python-docx
import docx
file_path = 'dear.docx'
doc = docx.Document(file_path)
for paragraph in doc.paragraphs:
print(paragraph.text)
for table in doc.tables:
for row in table.rows:
for cell in row.cells:
print(cell.text)
网友评论