使用Python从word文档中提取图像和文本
我想在一个充满 Word 文档的文件夹上运行一个脚本,该脚本读取文档并提取图像及其标题(图像正下方的文本)。根据我所做的研究,我认为 pywin32 可能是一个可行的解决方案。我知道如何使用 pywin32 查找字符串并将其拉出,但我需要图像部分的帮助。如何读取 docx 文件并在找到图像时发生事件?感谢您的帮助!我正在使用Python 2.7。
I would like to run a script on a folder full of word documents that reads through the documents and pulls out images and their captions (text right below the images). From the research I've done, I think pywin32 might be a viable solution. I know how to use pywin32 to find strings and pull them out, but I need help with the images part. How can I read through a docx file and have an event occur when an image is found? Thank you for any help! I am using Python 2.7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
可以解压缩 Docx 文件以提取图像。
Docx files can be unzipped for extracting the images.
在这篇文章中寻找一些灵感 如何在Word 2007 .docx 文件?
Find some inspiration in this post How can I search a word in a Word 2007 .docx file?
您可以使用 python 模块 docx2txt 从 docx 文件中提取文本和图像
You can use the python module docx2txt for extracting text as well as images from docx files
试试这个,它会起作用。
Try this it will work.