Is It Bug?

Mahan Marwat mahanmarwat at gmail.com
Sat Dec 7 19:58:24 EST 2013


Why this is not working.

>>> 'Hello, \\\\World'.replace('\\', '\\')

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'.



More information about the Python-list mailing list