Identify MIME types from a file's contents

Noah noah at noah.org
Sat Oct 19 14:10:00 EDT 2002


Are there any modules for automagically identifying MIME types of a file?
Currently I'm running the UNIX 'file' command in a child process, but I
want something more portable.

The 'mimetypes' module almost does what I want, but it is based on
file extension. For my application I don't always have the extension, so
I need something like 'file' that will guess the type from the contents.

Yours,
Noah



More information about the Python-list mailing list