【问题标题】:Converting .doc to pure text using Python使用 Python 将 .doc 转换为纯文本
【发布时间】:2017-07-05 04:13:04
【问题描述】:

我正在尝试使用 textract 将我的 .doc 文件转换为纯文本。

import textract
text = textract.process('path/to/file.extension')

但是我收到了这个错误

AttributeError: 'module' object has no attribute 'process'

【问题讨论】:

  • 您使用的是哪个版本的文本?
  • @Tanu 我正在使用 1.6.1
  • 您是否成功安装了所有其他依赖项? - apt-get install python-dev libxml2-dev libxslt1-dev antiword unrtf poppler-utils pstotext tesseract-ocr flac ffmpeg lame libmad0 libsox-fmt-mp3 sox libjpeg-dev swig libpulse-dev(适用于 Ubuntu)。在我的系统上运行良好。
  • @tanu 我不知道我需要 Textract 的这些其他依赖项。我有 Windows,我还应该安装它们吗?

标签: python ms-word text-extraction


【解决方案1】:

确保您尝试运行的 Python 文件未命名为 textract.py

如果是这个名字,你会得到错误:

AttributeError: 'module' object has no attribute 'process'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-25
    • 2022-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多