PyDocs

Nav

Internet Data Handling

guess_extension

mimetypes

function (source)
  • guess_extension(type, strict=True)
Guess the extension for a file based on its MIME type.

Return value is a string giving a filename extension, including the
leading dot ('.').  The extension is not guaranteed to have been
associated with any particular data stream, but would be mapped to the
MIME type 'type' by guess_type().  If no extension can be guessed for
'type', None is returned.

Optional 'strict' argument when false adds a bunch of commonly found,
but non-standard types.
0 Examples
No examples for mimetypes/guess_extension.
See Also
No see-alsos for mimetypes/guess_extension
0 Notes
No notes for guess_extension