Q. A text file contains alphanumeric text (say an.txt). Write a program that reads this text file and prints only the numbers or digits from the file.
Answer =
F = open("an.txt", "r") for line in F : words = line.split() for i in words : for letter in i : if(letter. isdigit()) : print(letter)
ReplyDeleteF = open("an.txt", "r")
for line in F :
words = line.split()
for i in words :
for letter in i :
if(letter. isdigit()) :
print(letter)
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )