fork(1) download
  1. import re
  2. rx = r'^;.*|([()])|\s+'
  3. s = """; Remove this line
  4. (?A or :B
  5. (G + D))"""
  6. print(list(filter(None, re.split(rx, s, flags=re.M))))
Success #stdin #stdout 0.02s 9640KB
stdin
Standard input is empty
stdout
['(', '?A', 'or', ':B', '(', 'G', '+', 'D', ')', ')']