fork(2) download
  1. import re
  2. text = "red 1 green 3 blue"
  3. print( re.split(r'red|green|blue', text) )
  4. print( list(filter(None, re.split(r'red|green|blue', text))) )
Success #stdin #stdout 0.02s 9428KB
stdin
Standard input is empty
stdout
['', ' 1 ', ' 3 ', '']
[' 1 ', ' 3 ']