string replace for back slash

S.Selvam Siva s.selvamsiva at gmail.com
Thu Feb 5 06:40:35 EST 2009


Hi all,

I tried to do a string replace as follows,

>>> s="hi & people"
>>> s.replace("&","\&")
'hi \\& people'
>>>

but i was expecting 'hi \& people'.I dont know ,what is something different
here with escape sequence.

-- 
Yours,
S.Selvam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090205/6eb08bed/attachment.html>


More information about the Python-list mailing list