Python program to how to find File Extension

exe = ['gif','png','jpeg','jpg','svg','txt']
filexe = input("Insert file with extension: ").split('.')
if len(filexe) >= 2:
 Extension = filexe[-1].lower()
 if Extension in exe:
  print("File extension exist")
  print("File extension does not exist")
 print("File does not have extension")




Insert file with extension: pythontutorial.txt
File extension exist


Insert file with extension: file extension
File does not have extension

Subscribe For Daily Updates