MySQL + SQL Statements + Quote escaping

Huw Lynes huwdotlynes at ic.ac.uk
Sat Feb 10 07:04:31 EST 2001


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



More information about the Python-list mailing list