Skip to content

Instantly share code, notes, and snippets.

@constructor-igor
Created April 22, 2015 13:36
Show Gist options
  • Save constructor-igor/387a2154945550baa5d4 to your computer and use it in GitHub Desktop.
Save constructor-igor/387a2154945550baa5d4 to your computer and use it in GitHub Desktop.
Splitting a String Python within a list
#http://stackoverflow.com/questions/23219400/splitting-a-string-python-within-a-list
>>> import re
>>> i = 'john(is,great),paul,school'
>>> re.split(r',+(?=[^()]*(?:\(|$))', i)
['john(is,great)', 'paul', 'school']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment