HTML到.doc转换器在Python? [英] html to .doc converter in Python?
本文介绍了HTML到.doc转换器在Python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用比萨,它是Python的HTML到PDF转换库.
I am using pisa, which is an HTML to PDF conversion library for Python.
Word文档是否存在相同的东西:用于Python的HTML到.doc转换库?
Does there exist the same thing for a Word document: an HTML to .doc conversion library for Python?
推荐答案
您可以使用 pywin32 python扩展中的win32com对于Windows,让MS Word为您转换.一个简单的例子:
You could use win32com from the pywin32 python extensions for windows, to let MS Word convert it for you. A simple example:
import win32com.client
word = win32com.client.Dispatch('Word.Application')
doc = word.Documents.Add('example.html')
doc.SaveAs('example.doc', FileFormat=0)
doc.Close()
word.Quit()
这篇关于HTML到.doc转换器在Python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文