what is wrong with that r"\"

kyosohma at gmail.com kyosohma at gmail.com
Tue Jul 3 09:16:43 EDT 2007


On Jul 3, 7:15 am, alf <ask at me> wrote:
> question without words:
>
>  >>> r"\"
>    File "<stdin>", line 1
>      r"\"
>         ^
> SyntaxError: EOL while scanning single-quoted string
>  >>> r"\ "
> '\\ '

One slash escapes the following character, so the proper way of
writing it is either

r"\\" or r"\""

See http://docs.python.org/ref/strings.html for more information.

Mike




More information about the Python-list mailing list