MySQL + SQL Statements + Quote escaping

Steve Holden sholden at holdenweb.com
Sat Feb 10 10:22:46 EST 2001


"Huw Lynes" <huwdotlynes at ic.ac.uk> wrote in message
news:slrn97kise.8g.huwdotlynes at Marvin.ic.ac.uk...
> In article <3A83FF9E.1E8CC176 at gocept.com>, Christian Theune wrote:
> >Hi there.
> >
> >i just tuned into python and it's really cool. I like it.
> >Before I came to python i used to write scripts in php.
> >There was a function called "addslashes" it escaped quotes and
> >slashes to make strings sql-safe.
> >
> >Is there any function like that in python? I didnt found on.
>
> There probably is but I usually just do a quick
> string.find() to to find all the quotes and then slice the string
> at the indexes returned and add in the slashes.
> But it seems like a common problem like this should have
> a module somewhere.
>
> Sorry I couldn't be of more help but I'm
> only a newbie myself.
>
> Huw Lynes
>
string.replace() works well.

regards
 Steve





More information about the Python-list mailing list