UNO Python bindings allows you to run python scripts inside OpenOffice / LibreOffice, such as Basic macroses.
They allow you to do almost everything that OpenOffice can do on its own, including creating ODT documents, but they must run in a specific environment and depend on OpenOffice.
Here is the basic tutorial for Python-UNO in OpenOffice: http://www.openoffice.org/udk/python/python-bridge.html
To edit ODT documents from Python, I found this library: https://joinup.ec.europa.eu/software/odfpy/home , but I never really tried it.
For my task (a small modification of an existing document), I finished manually editing the XML files in the .odt zod file, using the Python zipfile module and the lxml library to parse and edit the XML.
source share