Raw string fu

Fredrik Lundh fredrik at pythonware.com
Wed Oct 26 14:42:43 EDT 2005


Joshua Ginsberg wrote:

> >>> r'\'
> File "<stdin>", line 1
> r'\'
> ^
> SyntaxError: EOL while scanning single-quoted string
> >>> r'\\'
> '\\\\'
>
> Does that seem wrong to anybody else? Shouldn't the first one be
> syntactically correct?

the "r" prefix doesn't change how string literals are parsed; it only affects
how they are converted to string objects.

</F>






More information about the Python-list mailing list