要读取Word文档的内容,你可以使用python-docx库。首先,需要安装该库,可以使用以下命令进行安装:
pip install python-docx安装完成后,你可以使用以下代码来读取Word文档的内容:
from docx import Document# 打开文档doc = Document('example.docx')# 读取段落for para in doc.paragraphs: print(para.text)# 读取表格for table in doc.tables: for row in table.rows: for cell in row.cells: print(cell.text)上述代码会打印出Word文档中的所有段落和表格内容。

