bruce g wrote:

> What is the best way to parse a CSV string to a list?
> 
> For example, how do I parse:
>     'AAA,"BBBB,CCCC,DDDD",EEE,FFF,GGG'
> to get:
>     ['AAA','BBB,CCC,DDDD','EEE','FFF','GGG’]

>>> import csv
>>> next(csv.reader(['AAA,"BBBB,CCCC,DDDD",EEE,FFF,GGG']))
['AAA', 'BBBB,CCCC,DDDD', 'EEE', 'FFF', 'GGG']

For multiple records: 

list(csv.reader(text.splitlines(True)))

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to