Python 2.7:
>>> from mimetypes import guess_extension
>>> guess_extension('text/plain')
'.ksh'
Python 3.5:
>>> from mimetypes import guess_extension
>>> guess_extension('text/plain')
'.c'
How can I get a valid answer?
For me ".txt" would fit.
Even the filetype lib can't handle this :-(
See https://github.com/h2non/filetype.py/issues/30
from content-type text/plain has file extension .ksh?
No comments:
Post a Comment