Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- pattern = re.compile("\d+")
- text = input()
- all_matches = []
- while True:
- if len(text) == 0:
- break
- matches = pattern.finditer(text)
- for match in matches:
- all_matches.append(match.group())
- text = input()
- for element in all_matches:
- print(element, end=" ")
- input:
- The300
- What is that?
- I think it's the 3rd movie
- Lets watch it at 22:45
- output:
- 300 3 22 45
Add Comment
Please, Sign In to add comment