【问题标题】:python module to convert doc/pdf/docx/rtf formats to text [duplicate]python模块将doc/pdf/docx/rtf格式转换为文本[重复]
【发布时间】:2017-04-30 15:45:02
【问题描述】:

我正在谷歌搜索答案,但我找不到一个模块来将 doc/pdf/docx/rtf 转换为文本

有没有python模块可以将doc/pdf/docx/rtf格式转换为文本?

【问题讨论】:

标签: python pdf text module doc


【解决方案1】:

一个模块来统治他们!

textract。它支持许多用于文本提取的文件类型,包括您在问题中指定的所有文件类型。

  • .doc via antiword
  • .pdf 通过 pdftotext(默认)或 pdfminer.six
  • .docx 通过 python-docx
  • .rtf 通过 unrtf

PDF 示例

http://textract.readthedocs.io/en/latest/python_package.html

import textract
text = textract.process('path/to/a.pdf', method='pdfminer')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-14
    • 2014-03-11
    • 1970-01-01
    • 2017-07-06
    • 1970-01-01
    相关资源
    最近更新 更多