Sin*_*giz 2 python docx readlines
如何从python中的单词(docx)文件中读取。我可以读取 txt 文件,但不能读取 MS Office word 文档。有什么建议?
有几个包可以让你做到这一点。查看
import docx2txt
# extract text
text = docx2txt.process("file.docx")
# extract text and write images in /tmp/img_dir
text = docx2txt.process("file.docx", "/tmp/img_dir")
Run Code Online (Sandbox Code Playgroud)
textract(通过docx2txt 工作)。
由于.docx文件只是.zip具有更改扩展名的文件,这显示了如何访问内容。这是与.doc文件的显着差异,也是上述部分(或全部)不适用于.docs 的原因。在这种情况下,您可能必须先转换doc-> docx。antiword是一种选择。
| 归档时间: |
|
| 查看次数: |
1746 次 |
| 最近记录: |