【发布时间】:2021-08-23 08:16:04
【问题描述】:
大家好,我正在尝试使用 python 将 docx 文件转换为 rtf 文件我已经做了很多谷歌搜索,但找不到任何我想要的答案
input = test.docx
output = test.rtf
【问题讨论】:
-
这个答案有帮助吗? stackoverflow.com/a/65724761/6557716
标签: python
大家好,我正在尝试使用 python 将 docx 文件转换为 rtf 文件我已经做了很多谷歌搜索,但找不到任何我想要的答案
input = test.docx
output = test.rtf
【问题讨论】:
标签: python
您可以使用docx 模块并使用此指令安装docx 模块:pip install python-docx。检查代码。
from docx import Document
f = open('test.docx', 'rb')
document = Document(f)
document.save('test.rtf')
【讨论】:
https://pypi.org/project/pyandoc/ 这可能会有所帮助
让我们从一个 Markdown 文档开始:
doc = pandoc.Document()
doc.markdown = '''
# I am an H1 Tag
* bullet point
* more points
* point with [link](http://kennethreitz.com)!
现在让我们将其转换为 ReST 文档:
>>> print doc.rst
I am an H1 Tag
==============
- bullet point
- more points
- point with `link <http://kennethreitz.com>`_!
编辑:阅读文档
【讨论】: