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.  The info you've found are the file name
"mimetype", the uncompressed contents of that file
"application/vnd.oasis.opendocument.text", and part of the ZIP magic
number "PK".  You should be able to use the "zipfile" module to check
to see if the file a ZIP file, if it has a member named "mimetype" and
if the contents of the file match one of the OpenOffice MIME types.

                                      Ross Ridge

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to