Splitting strings in python using import re
Question: Why does this work:

    
    
    string = 'N{P}[ST]{P}'
    
    >>> import re
    >>> re.split(r"[\[\]]",  string)
    >>> ['N{P}', 'ST', '{P}']
    

But this don't?

    
    
    >>> re.split(r"{\{\}}", string)
    


Answer: You have to do this:

    
    
    re.split(r"[{}]", string)
    

`r"{\{\}}"` is a special re syntax to repeat groups (ex: `(ab){1,3}` matches
`ab`, `abab` or `ababab`) but not the character range (note that you don't
have to escape the curly braces in a character range). (I admit I don't know
what your strange regex is supposed to do specially in the re.split context,
but not what you want :))

