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
dorivalmartinez
0
Newbie Poster
Recommended Answers
Jump to PostOpen 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.
Jump to PostIf 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.
All 5 Replies
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Salem
5,138
Posting Sage
dorivalmartinez
0
Newbie Poster
dorivalmartinez
0
Newbie Poster
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
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.