from docx import * # 创建一个已存在的 word 文档的对象 file = Document('测试.docx') # 读取每个段落的内容并输出 for it in file.paragraphs: print(it.text) # 读取表格中的内容并输出 for it in file.tables: for row in it.rows: for cell in row.cells: print(cell.text)