1

我想用 python3.3 和 python-docx 0.5.0 读取一个 docx 文件

我阅读了一个 docx 文档,但我找不到如何阅读文件,只有如何打开......

请举例说明如何使用 python-docx 0.5.0 读取 docx 文件

4

1 回答 1

1

您可以通过以下代码查看(文本)文档的内容。

from docx import Document

document = Document(file_path)
text = []
for data in document.paragraphs:
    text.append(data.text)
    print(data.text)
于 2019-08-20T12:32:16.767 回答