Quoting quotes

Victor Stinner victor.stinner at haypocalc.com
Fri Feb 26 13:42:46 CET 2010


Le vendredi 26 février 2010 13:29:04, candide a écrit :
> But the first method doesn't run correctly :
> >>> print """The play "All's Well That Ends Well""""
> 
>   File "<stdin>", line 1
>     print """The play "All's Well That Ends Well""""
>                                                    ^
> SyntaxError: EOL while scanning single-quoted string

Use triple simple single quotes:

>>> print '''"All's Well That Ends Well"'''
"All's Well That Ends Well"

-- 
Victor Stinner
http://www.haypocalc.com/



More information about the Python-list mailing list