ubuntu下通过python处理word文件中的表格

来源:互联网 发布:淘宝能办理信用卡 编辑:程序博客网 时间:2024/04/28 01:41

简介:python处理word文件需要在windows下使用win32com,在linux下我没找到可以使用的包。

解决办法:将doc文件转换成html,然后通过脚本解析html。

安装:abiword是用来将doc转换成html的工具

sudo apt-get install abiword

转换命令,转换test.doc为test.html

abiword --to=html test.doc

如果有很多doc文件可以考虑放在一个目录下用*.doc转换


安装:Beautifulsoup解析html

官网:www.crummy.com/software/BeautifulSoup/

sudo easy_install beautifulsoup4