Nick wrote:
> Hi all,
>
> Is this expected behavior?
>
>>>> s = '123;abc'
>>>> s.replace(';', '\;')
> '123\\;abc'
>
> I just wanted a single backslash. I can see why this probably happens
> but i wondered if it is definitely intentional.
There is only a single backslash. But the interactive prompt will use the
repr()-function to print out returned values. Which will for strings print
their escaped syntax.
Try the above with a
print s.replace(...)
and you will see your desired outcome.
diez
--
http://mail.python.org/mailman/listinfo/python-list