O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

mimetypes

The mimetypes module is used to guess the MIME type associated with a file, based on its filename extension. It also converts MIME types to their standard filename extensions. MIME types consist of a type/subtype pair. The following list shows the MIME types recognized by Python 2.4:

File SuffixMIME Type
.aapplication/octet-stream
.aiapplication/postscript
.aifaudio/x-aiff
.aifcaudio/x-aiff
.aiffaudio/x-aiff
.auaudio/basic
.avivideo/x-msvideo
.battext/plain
.bcpioapplication/x-bcpio
.binapplication/octet-stream
.bmpimage/x-ms-bmp
.ctext/plain
.cdfapplication/x-netcdf
.cpioapplication/x-cpio
.cshapplication/x-csh
.csstext/css
.dllapplication/octet-stream
.docapplication/msword
.dotapplication/msword
.dviapplication/x-dvi
.emlmessage/rfc822
.epsapplication/postscript ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required