[Tutor] sample dictionairies

Alan Gauld alan.gauld at btinternet.com
Mon Apr 20 09:26:35 CEST 2015


On 20/04/15 04:49, Jim Mooney wrote:

> Come to think of it, since I used  |  as a delimiter, what happens if you
> generate a CSV file from data that already has commas in the text?

The CSV format covers that eventuality: You put quotes around the
item with the comma.
And if there are already quotes?
And if there are newlines inside one of the fields?

Its all covered in the CSV spec.

Which is why you should use the csv module to work with csv files,
it knows how to deal with these various exceptional cases.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list