Python:读取Word的内容

来源:互联网 发布:微信联系人数据库恢复 编辑:程序博客网 时间:2024/05/16 11:56

需要安装一个包,python-docx。

但是导入的时候,输入的是import docx。


这里暂时只总结读取word中段落的方法。


import docx

document = docx.Document(file_name)

for p in document.paragraphs:

p = document.paragraphs[i]

print(p)


原创粉丝点击