sheu at bu.edu
Sat Sep 20 21:23:58 CEST 2003
You should assign your variable a raw string, not putting the r to the
>>> name = r"kr\xdf6;ger"
>>> name.replace('\\', '&#')
>I can do the following replacement:
>But how can I do this using a variable which contains the above string?
>Obviously, the following code returns not the string with replacement
>but the name of the variable itself:
>name = "kr\xdf6;ger"
>Sorry, if this is a stupid question but I have not found an answer so
>far (or I have been using the wrong keywords for searching).
>Thanks for any help.
More information about the Python-list