representing a literal single slash

Jonathan Claggett hellen at
Sat Sep 14 22:28:02 EDT 2002

Here is an easy question (I'm hoping).

I'm trying to process a string so that all doubled up backslashes (\\)
are replaced with a single backslash (\).

The obvious approach doesn't work since a single backslash can't end a

str = str.replace('\\', '\') # broken

So, how does one represent a literal single slash? unicode or hex
values perhaps?



More information about the Python-list mailing list