1>>> str = "h3110 23 cat 444.4 rabbit 11 2 dog"
2>>> [int(s) for s in str.split() if s.isdigit()]
3[23, 11, 2]
4
1string = "abc123"
2# Method 1
3''.join(char for char in string if char.isdigit())
4
5#Method 2
6import re
7re.sub("[^0-9]", "", string)
1string = "I am 14 years old"
2for i in string.split():
3 if i.isdigit():
4 print(i)
5print()
6
1>>> import re
2>>> string1 = "498results should get"
3>>> int(re.search(r'\d+', string1).group())
4498