How to do this? Can someone help me with this question?
Write A Python Program To Accept A File Name From The User And Print The Extension Of The File Name.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Swathi
Here is a python program “to accept the file name from the user and print the extension of the file name”.
Sample code for accepting the file name in python:
inputFileName=input(“enter name of input file:”)
input file=open(inputFileName,”r”)
print(“opening file”, inputFileName, “for reading.”)1.
Open the file and associate the file with a file variable(file is “locked” for writing).
Flow chart of the program :
You need to write the python program code to accept the file name from the user and print the extension of the file name in this way .
I hope this answer helped you.
you may also read:
Python Program To Count The Number Of Vowels In A Sentence.