Escaping the semicolon?

Sergio Correia sergio.correia at gmail.com
Tue Dec 4 11:01:40 EST 2007


On Dec 4, 2007 10:40 AM, Nick <nickjbyrne at gmail.com> wrote:


> Is this expected behavior?
>
> >>> s = '123;abc'
> >>> s.replace(';', '\;')
> '123\\;abc'
>

Everything is Ok. It's still a single backslash. Try:

>>> print  s.replace(';', '\;')

Or
>>> x = s.replace(';', '\;')
>>> print x

Best,
Sergio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071204/1b5cd036/attachment.html>


More information about the Python-list mailing list