What's the Scoop on \\ for Paths? (Win)
python.list at tim.thechases.com
Sun Jan 31 20:59:43 CET 2010
W. eWatson wrote:
> What am I missing here? Looks OK to me.
> >>> abc.replace(r'\',r'z')
> SyntaxError: invalid syntax
A raw string can't end in a single backslash (something that
occasionally annoys me, but I've learned to deal with it).
File "<stdin>", line 1
SyntaxError: EOL while scanning single-quoted string
My guess is that the parser sees the first call as
r"r\'r" <-- how your single-quoted is interpreted
z' <-- the leftovers that cause the syntax error
More information about the Python-list