string.replace

rei05 at gmx.de rei05 at gmx.de
Fri May 5 13:12:37 EDT 2000


> On Fri, 5 May 2000 rei05 at gmx.de wrote:
> > so i tried string.replace(s,"'","\'"), but this doesn`t work. 
> 
sorry, i forgot to mention, that i tried:
> 
> string.replace(s,"'","\\'")
> 
too, but the result of this is like the following:

>>> import string
>>> s="asdasd'a'asddads"
>>> string.replace(s,"'","\\'")
"asdasd\\'a\\'asddads"

and i wish to have ...\'a\'..., not ...\\'a\\'...

-- 
Sent through GMX FreeMail - http://www.gmx.net




More information about the Python-list mailing list