Ask Your Question

Revision history [back]

By definition the r before the string means that the backslashes are automatically escaped. Note the difference

$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> r"""\
... """
'\\\n'
>>> """\
... """
''

or

>>> r"\n"
'\\n'
>>> "\n"
'\n'