mimetypes.MimeTypes()
mimetypes.MimeTypes() is a Python function in the Mimetypes Module category. Creates a MIME types registry with optional custom mappings. The syntax is mimetypes.MimeTypes(filenames=(), strict=True). Returns: MimeTypes object. A typical example: mime = mimetypes.MimeTypes()
mime.suffix_map(".jpg", "image/jpeg"). A close sibling is mimetypes.guess_type(), which guesses the MIME type and encoding of a file from its URL/extension. A close sibling is mimetypes.guess_extension(), which guesses the file extension for a given MIME type. A close sibling is mimetypes.init(), which initializes the MIME type database from system files. A close sibling is mimetypes.read_windows_registry(), which loads MIME types from Windows registry (Windows only). More about this category: MIME type guessing — guess_type, guess_extension, init. Related Mimetypes Module entries: mimetypes.guess_type(), mimetypes.guess_extension(), mimetypes.init(), mimetypes.read_windows_registry(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try mimetypes.MimeTypes() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.