Q. Write a program to accept a filename from the user and display all the lines from the file which contain Python comment character '#'.


Answer = 


user = input("Enter file name :-")
f = open(user + ".txt",'r')

data = f.readlines()
for i in data :
    if "#" in i :
        print(i)

f.close()


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post