从python中的MS Word文件中提取文本 [英] extracting text from MS word files in python

查看:359
本文介绍了从python中的MS Word文件中提取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要使用python中的MS Word文件,有python win32扩展名,可以在Windows中使用.我该如何在linux中做同样的事情? 有图书馆吗?

for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux? Is there any library?

推荐答案

您可以对 Antiword进行子过程调用. Antiword是一个Linux命令行实用程序,用于从word doc中转储文本.适用于简单文档(显然会丢失格式).它可以通过apt或RPM来获得,或者您可以自己编译.

You could make a subprocess call to antiword. Antiword is a linux commandline utility for dumping text out of a word doc. Works pretty well for simple documents (obviously it loses formatting). It's available through apt, and probably as RPM, or you could compile it yourself.

这篇关于从python中的MS Word文件中提取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆