Help with strings please

Sreekant Kodela sreekantk at freenet.co.uk
Fri Jul 9 06:35:41 EDT 1999


Many thanks Dear Oleg

Regards
sreekant

Oleg Broytmann wrote:

> On Fri, 9 Jul 1999, Sreekant Kodela wrote:
> > I seem to be in trouble here. I am trying to make some cgi scripts for
> > my web site. I am using the postgresql as the backend db and a form
> > based address book and news forum etc. The problem is everything is
> > working ok as long as noone uses ' and " in the text. If they do, bingo
> > , postgres refuses to accept. I tried using string library [mainly
> > string.join(string.split('awkward'"'st'ring')). It works sometimes and
> > doesn't some times.
> >
> > Any better and efficient way to deal with this situation !
> > Any suggestions and ideas will be greatly appreciated.
>
> s = string.replace(s, "'", "''")
> s = string.replace(s, '"', '\\"')
>
> > Thanks
> > sreekant
>
> Oleg.
> ----
>     Oleg Broytmann        Netskate/Inter.Net.Ru        phd at emerald.netskate.ru
>            Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list