how to convert docx file into rtf file using python Is there is any module to do this?

Viewed 486

hi everyone I'm trying to convert docx file into rtf file with python I've done lots of googling but can't found any answer I want

input = test.docx
output = test.rtf 
2 Answers

You can use docx module and install docx module with this instruction : pip install python-docx. Check the code.

from docx import Document

f = open('test.docx', 'rb')
document = Document(f)

document.save('test.rtf')

https://pypi.org/project/pyandoc/ this may help

Let’s start with a Markdown document:

doc = pandoc.Document()
doc.markdown = '''
# I am an H1 Tag

* bullet point
* more points
* point with [link](http://kennethreitz.com)!

Now let’s convert that into a ReST document:

>>> print doc.rst

I am an H1 Tag
==============


-  bullet point
-  more points
-  point with `link <http://kennethreitz.com>`_!

edit: read the docs

Related