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 Suffix | MIME Type |
---|---|
.a | application/octet-stream |
.ai | application/postscript |
.aif | audio/x-aiff |
.aifc | audio/x-aiff |
.aiff | audio/x-aiff |
.au | audio/basic |
.avi | video/x-msvideo |
.bat | text/plain |
.bcpio | application/x-bcpio |
.bin | application/octet-stream |
.bmp | image/x-ms-bmp |
.c | text/plain |
.cdf | application/x-netcdf |
.cpio | application/x-cpio |
.csh | application/x-csh |
.css | text/css |
.dll | application/octet-stream |
.doc | application/msword |
.dot | application/msword |
.dvi | application/x-dvi |
.eml | message/rfc822 |
.eps | application/postscript ... |
Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.