Computer Science, asked by chouhanprashant574, 5 months ago


À 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.
In python language
.
.
.
who will answer I will mark as brainliest ​

Answers

Answered by pjgaikar06
15

fname = input("Enter file name: ")

with open(fname, 'r') as f:

   for line in f:

       words = line.split()

       for i in words:

           for letter in i:

               if(letter.isdigit()):

                   print(letter)

Similar questions