[Tutor] Writing to CSV string containing quote and comma
Jignesh Sutar
jsutar at gmail.com
Tue Dec 10 10:41:12 CET 2013
Thanks Steve, Alan. Sound advice. Very much a novice so trying to pick up
good habits. Will definitely take on board your comments!
Thanks again.
Jignesh
On 10 December 2013 00:46, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 09/12/13 23:46, Steven D'Aprano wrote:
>
> Python has two different quote characters ' and " so you can use one for
>> delimiters and the other inside the string:
>>
>
> And if you need both you can also use triple quotes.
>
>
> If you need both, you can escape the one that matches the delimiter:
>>
>> s = 'this string contains both \' single and " double quotes'
>>
>
> Or using triple quotes:
>
> > s = '''this string contains both ' single and " double quotes'''
>
> Python will then do the escaping for you.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131210/8fb27c6f/attachment.html>
More information about the Tutor
mailing list