Program - Removal all the characters other than integers from string


Topic: Program - Removal all the characters other than integers from string

Solution

str1 = 'I am 25 years and 10 months old'
res = "".join([item for item in str1 if item.isdigit()])
print(res)



List all Python Programs