Programming Examples
Python code to display digits from abc.txt file
Write a Python Program which read only digits from a abc.txt file
fp=open("abc.txt","r")
data=fp.read()
for a in data:
  if a.isdigit():
    print(a)
Output
Write a Python Program which read only digits from a abc.txt file
fp=open("abc.txt","r")
data=fp.read()
for a in data:
  if a.isdigit():
    print(a)
Output