Is It Bug?
Mark Lawrence
breamoreboy at yahoo.co.uk
Sat Dec 7 20:06:45 EST 2013
On 08/12/2013 00:59, Mahan Marwat wrote:
> Why this is not working.
>
>>>> 'Hello, \\\\World'.replace('\\', '\\')
Whoops a daisy!!! --------------^^^^--^^^^ ???
>
> To me, Python will interpret '\\\\' to '\\'. And the replace method will replace '\\' with '\'. So, the result will be 'Hello, \World'. But it's give me 'Hello, \\\\World'.
>
> The result I want form the code is 'Hello, \World'.
>
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Python-list
mailing list