如何使用python从word文档中提取图像/徽标并将其存储在文件夹中。下面的代码将docx转换为html,但是它没有从html中提取图像。任何建议都会有很大的帮助。在
profile_path = <file path>
result=mammoth.convert_to_html( profile_path)
f = open(profile_path, 'rb')
b = open(profile_html, 'wb')
document = mammoth.convert_to_html(f)
b.write(document.value.encode('utf8'))
f.close()
b.close()
您可以使用docx2txt库,它将读取.docx文档并将图像导出到指定的目录(必须存在)。在
执行后,图像将位于/home/example/img/中,变量text将包含文档文本。它们将被命名为image1.png。。。图像.png按照外表的顺序。在
注意:Word文档必须是.docx格式。在
相关问题 更多 >
编程相关推荐