Say I have an arbitrary string like
"abc 123 def 456"
How would I take out the integers so that it can print "123456" without using regex?
Say I have an arbitrary string like
"abc 123 def 456"
How would I take out the integers so that it can print "123456" without using regex?
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()