Find the mime type of a file.

Olive diolu at
Wed Jan 25 12:04:32 EST 2012

I want to have a list of all the images in a directory. To do so I want
to have a function that find the mime type of a file. I have found
mimetypes.guess_type but it only works by examining the extension. In
GNU/Linux the "file" utility do much better by actually looking at the
file. Is there an equivalent function in python (as a last resort I can
always use the external file utility).


More information about the Python-list mailing list