I tried to read .odt using python with "odfpy" library, but it still doesn't work. Could you suggest me how to read .odt file using python or give me a simple source code.
Thank you
First install odfpy library then,
In [21]: from odf import text, teletype
...: from odf.opendocument import load
...:
...: textdoc = load("your.odt")
...: allparas = textdoc.getElementsByType(text.P)
...: teletype.extractText(allparas[0])
...:
Out[21]: 'Hello World!'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With