一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Python中docx2txt库代码使用说明

时间:2021-03-06 编辑:袖梨 来源:一聚教程网

本篇文章小编给大家分享一下Python中docx2txt库代码使用说明,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。

docx2txt是基于python的从docx文件中提取文本和图片的库。

代码是从python-docx中获取的。它也可以从页眉,页脚和超链接中提取文本。它现在也可以提取图像。

安装

pip install docx2txt

运行

1、命令行运行

# extract text
docx2txt file.docx
# extract text and images
docx2txt -i /tmp/img_dir file.docx

2、在python中调用

# extract text
docx2txt file.docx
# extract text and images
docx2txt -i /tmp/img_dir file.docx

热门栏目