split string but ignore sep inside double quotes
andrea.crotti.0 at gmail.com
Wed Apr 13 18:22:49 CEST 2011
Jonno <jonnojohnson at gmail.com> writes:
> I have the following unicode object:
> u'3,"Some, text",more text'
> and I want to split it into a list like this:
> [3,"Some, text", more text]
> In other words I want to split on the comma but not if it's inside a
I'm not sure how but also this seems to work:
In: s = '2,"some, text",more text'
In : re.split(r'(?<=">),', s)
Out: ['2,"some, text",more text']
I just wanted to try the lookahead functions, which I never use but
sometimes might come handy.
More information about the Python-list