I'm writing a Python script that involves going through a bunch of OpenDocument text files in a directory tree and sorting them based on a text field that always occurs in the same place in each file.

For this, I need a Python library that allows me to read in text from an OpenDocument text file. Since these files can be quite large, it would be great if the library had a way to read in the first line or so of a file (as the text field I'm looking for always shows up in the first line), as well as a way to iterate through the lines of a file.

1 Answer 1


The python package ezodf2 should do the job nicely as it can open, edit and create odf format documents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.