faqts : Computers : Programming : Languages : Python : Language and Syntax

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 4 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

How do I write a triple-quoted string that ends with a backslash?

May 18th, 2000 06:56
Michael Hudson, Beat Bolli, unknown unknown,


The same way you write a normal string that ends in a backslash; double
it up, eg. """abc\\""".

Don't be fooled by

>>> """asd\\"""
'asd\\'

in the interpreter; if you want to see the string properly, you should
do:

>>> print """asd\\"""
asd\