Write a Python program to accept a filename from the user and print the extension of that file


Introduction

Write a Python program to accept a filename from the user and print the extension of that file. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. filename = input("Input the Filename: ")
  2. f_extns = filename.split(".")
  3. print ("The extension of the file is : " + repr(f_extns[-1]))
  4.  

Result

python language techstudy.org

     





Related Topics




Popular Posts