Help with strings please

Oleg Broytmann phd at emerald.netskate.ru
Thu Jul 8 11:44:02 EDT 1999


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