split CSV fields

Diez B. Roggisch deets at nospam.web.de
Thu Nov 16 05:34:37 EST 2006


robert wrote:

> What is a most simple expression for splitting a CSV line with "-protected
> fields?
> 
> s='"123","a,b,\"c\"",5.640'

Use the csv-module. It should have a dialect for this, albeit I'm not 100%
sure if the escaping of the " is done properly from csv POV. Might be that
it requires excel-standard.

Diez



More information about the Python-list mailing list