Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input_string = "lol num 024, and 20942 when 4.4 points5 lo6lo"
- found_numbers = []
- buffer_string = ''
- for char in input_string:
- if char.isdigit():
- if char != '0' or buffer_string:
- buffer_string += char
- else:
- if buffer_string:
- found_numbers.append(int(buffer_string))
- buffer_string = ''
- print(found_numbers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement