Determining when a file is an Open Office Document

tubby tubby at bandaheart.com
Thu Jan 18 23:44:29 EST 2007


Ross Ridge wrote:
> tubby wrote:
>> Silly question, but here goes... what's a good way to determine when a
>> file is an Open Office document? I could look at the file extension, but
>> it seems there would be a better way. VI shows this info in the files:
>>
>> mimetypeapplication/vnd.oasis.opendocument.textPK
> 
> It's a ZIP archive. 

Thanks, I used this approach:

import zipfile
if zipfile.is_zipfile(filename):
    ...

Now, If only I could something like that on PDF files :)



More information about the Python-list mailing list