Hello.
I would like to open and read OO Writer.
I used the script:
[file = open('myfile.odt', 'r']
[lines = file.readlines()]
[file.close()]
[for i in lines:
print i]
I get some strange characters. I had write 'rb', instead 'r', but it did not work.
I have copied a ODT file and saved it as txt file.
Is there a better way to open and read Open Office Writer files?
Thanks,
Dorival

Open Office Writer text saved as an .odt file contains a fair amount of formatting directives, Save your file as a plain Text (.txt) file, so you can read it with Python.

If you want to make any sense of OO documents, you first have to unzip them.

Example - just rename your foo.odt to foo.zip, then examine it with your ZIP program.
All the interesting stuff is stored as a series of XML files.

Open Office Writer text saved as an .odt file contains a fair amount of formatting directives, Save your file as a plain Text (.txt) file, so you can read it with Python.

Thanks. I did it and it worked.

Thanks. I am reading something about that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.