import retext = "red 1 green 3 blue"print( re.split(r'red|green|blue', text) )print( list(filter(None, re.split(r'red|green|blue', text))) )
Standard input is empty
['', ' 1 ', ' 3 ', ''] [' 1 ', ' 3 ']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!