for your specific question, you can just use .isdigit()
s = "abc 123 def 456"
for ch in s:
if ch.isdigit():
print(ch, end='')
print()
5
solved How to extract integers from a random string without using regex? [closed]
for your specific question, you can just use .isdigit()
s = "abc 123 def 456"
for ch in s:
if ch.isdigit():
print(ch, end='')
print()
5
solved How to extract integers from a random string without using regex? [closed]