I'm struggling to understand what the init() function does in the python mimetypes package. Is it an outdated function that isn't needed in more recent versions of python?
mimetypes.init()
is useful if you want to add MIME type / extension mappings beyond the default. If you don't need to do that, then there's no need to call mimetypes.init()
; just use the utility functions normally, and they'll call it themselves if necessary. If you do need to do that, aside from mimetypes.init()
there's also mimetypes.read_mime_types()
and mimetypes.add_type()
.
This applies to Python 2 and 3.