Write a Python program to select integers from a string and print those integers


Topic: Write a Python program to select integers from a string and print those integers

Solution

s = input()
l = len(s)
i = 0
while i < l:
    num = ''
    symbol = s[i]
    while symbol.isdigit():
        num += symbol
        i += 1
        if i < l:
            symbol = s[i]
        else:
            break
    if num != '':
        print(num)
    i += 1



List all Python Programs