Tim Chase wrote:
  >>> r"a\"
  SyntaxError: EOL while scanning string literal (<pyshell#45>, line 1)

It seems the parser is interpreting the backslash as an escape
character in a raw string if the backslash is the last character.
Is this expected?

Yep...as documented[1], "even a raw string cannot end in an odd number of backslashes".

So how do you explain this?

    >>> r'a\'b'
    "a\\'b"

The backslash is kept, but it causes the following quote to be escaped.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to