Split with python

John Machin sjmachin at lexicon.net
Tue Aug 29 19:58:39 EDT 2006


tobiah wrote:

> Of course, fixing the csv file takes a little more work.  It sounds like the
> test lines given were just one of the fields, and there are
> the quotes to worry about.
>
[snip]
>
> But then this fails if there are commas in the
> data.  I could split and join on '","' but then
> that fails when 'x' is either the first or last field.
>
> Are there tools in the csv module that make this
> easier?

There are no "tools". The main (whole?) purpose of the csv module is to
intelligently handle the embedded comma and embedded quote problems on
both input and output. May I suggest that you read the documentation?




More information about the Python-list mailing list