This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: print r"\" cause SyntaxError
Type: behavior Stage: resolved
Components: None Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, vbem
Priority: normal Keywords:

Created on 2012-02-28 08:47 by vbem, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg154538 - (view) Author: lilei (vbem) Date: 2012-02-28 08:47
$ python
Python 2.7.1 (r271:86832, Apr 16 2011, 23:27:12) 
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print r'\'
  File "<stdin>", line 1
    print r'\'
             ^
SyntaxError: EOL while scanning string literal
>>> 

I just want to print a raw string r'\', however, SyntaxError.
What is the reason?
msg154539 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-02-28 08:48
See http://docs.python.org/faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-backslash
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58355
2012-02-28 08:48:37ezio.melottisetstatus: open -> closed

nosy: + ezio.melotti
messages: + msg154539

resolution: not a bug
stage: resolved
2012-02-28 08:47:29vbemcreate