[Tutor] Writing to CSV string containing quote and comma

Steven D'Aprano steve at pearwood.info
Mon Dec 9 23:28:32 CET 2013


Joel, 

You don't appear to have actually written anything in your response. 
Every line in your post starts with a ">" quoting J Sutar's original 
post, with nothing new added apart from your signature at the end.




On Mon, Dec 09, 2013 at 04:57:50PM -0500, Joel Goldstick wrote:
> On Mon, Dec 9, 2013 at 4:52 PM, J Sutar <jsutar at gmail.com> wrote:
> 
> > # Re-sending from registered email address #.
> >
> > Hi,
> >
> > Posting for first time so hope I get the forum etiquette and rules right,
> > please let me know otherwise.
> >
> > I'm trying to write to csv a string which contains double quotation marks
> > and a comma however I'm finding that the write reads the comma as a
> > delimiter. If try wrap the string around double quotes it clashes with the
> > raw quotes originally within the string text (which I'd like to/must
> > preserve). Replacing double quotes with single quotes is neither an option
> > as I may have text containing single quotes (as in the number four example
> > below).
> >
> > Python has a csv reader and writer module.  You should check it out.
> >
> >
> > A helping hand on this would be very much appreciated.
> >
> > Thanks in advance.
> > Jignesh
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
> >
> >
> 
> 
> -- 
> Joel Goldstick
> http://joelgoldstick.com

> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor

-- 
Steven


More information about the Tutor mailing list