This small package returns the file format of a given file extension or Unknown
if file extension is unknown.
pip install py-ext-to-format
from py_ext_to_format import ExtToFormat
converter = ExtToFormat()
converter.get_format('.js') # returns JavaScript
We'd love contributions to the known file extensions/formats.
Any file extension and its file format is available under py_ext_to_format/formats.json
.
{
".js": "JavaScript"
}