+ 2

How to make a python program to accept a filename from user and print the extension of that?

Input and Output Should look something like this : Input : abc.py The extension of the file is : 'python'

7th Jun 2020, 9:41 AM
Atsin
Atsin - avatar
2 odpowiedzi
+ 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.
7th Jun 2020, 9:53 AM
Seb TheS
Seb TheS - avatar