Re: split string but ignore sep inside double quotes

2011-04-13 Thread Andrea Crotti
Andrea Crotti writes: > > I'm not sure how but also this seems to work: > In[20]: s = '2,"some, text",more text' > > In [21]: re.split(r'(?<=">),', s) > Out[21]: ['2,"some, text",more text'] > > I just wanted to try the lookahead functions, which I never use but > sometimes might come handy. Eh e

Re: split string but ignore sep inside double quotes

2011-04-13 Thread Andrea Crotti
Jonno writes: > All, > > 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 > double-quote. > > Thanks. I'm not sure how but al

Re: split string but ignore sep inside double quotes

2011-04-13 Thread Tim Golden
On 13/04/2011 15:59, Jonno wrote: 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 double-quote. You want the csv module which is desi

split string but ignore sep inside double quotes

2011-04-13 Thread Jonno
All, 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 double-quote. Thanks. -- http://mail.python.org/mailman/listinfo/python-list