New course! Every coder should learn Generative AI!
Try a free lesson1 Answer
+ 4
You could use split method to easily separate extension from filename and you could have a similar dictionary:
{"py": "python", "txt": "text", ...}
to know which extension represents which file.