0

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

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by vegaseat
0

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.

0

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.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.