Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: add a new mimetype

How can I add a new mimetype using the add_type() function in the mimetypes package? Do I need to do something with the python file system? If I try something like: add_type('text/new', 'new') nothing seems to happen.

like image 281
Michael Avatar asked Sep 15 '25 15:09

Michael


1 Answers

The extension needs to have a period in front of it. add_type('text/new', '.new') works.

like image 82
Michael Avatar answered Sep 17 '25 06:09

Michael