[Python-Dev] Backslash at end of raw string

Rob Cliffe rob.cliffe at btinternet.com
Sat Dec 12 09:36:34 CET 2009

Python (e.g. 2.5) does not accept a backslash as the LAST character of a raw string:

>>> r"\"
  File "<stdin>", line 1
Syntax Error: EOL while scanning single-quoted string.

path = r'\MyDir\MySubDir\'  # raises same error
path = r'\MyDir\MySubDir'   # no error

Isn't this a bug?

Rob Cliffe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20091212/a8afb55b/attachment.htm>

More information about the Python-Dev mailing list