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@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to