[issue34926] Adding "mime_type" method to pathlib.Path

Antoine Pitrou report at bugs.python.org
Tue Oct 9 04:08:41 EDT 2018


Antoine Pitrou <pitrou at free.fr> added the comment:

I would rather have the mimetypes module improved to accept Path-like objects, so that the following works:

>>> p = Path('LICENSE.txt')
>>> mimetypes.guess_type(p)
('text/plain', None)

It should be quite simple to implement as well.

----------
components: +Library (Lib)
keywords: +easy

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34926>
_______________________________________


More information about the Python-bugs-list mailing list