import retxt = "123 4 56-7 maine x1s56"x = re.findall(r"\d+(?:\s|(?=-))", txt)print(x) # => ['123 ', '4 ', '56', '7 ']
Standard input is empty
['123 ', '4 ', '56', '7 ']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!