MySQLdb + Python + quotes

Lars Hoeyrup Jensen robinhat at rhk.dk
Tue May 9 17:18:22 EDT 2000


I use the MySQLdb module to make Python interact with MySQL. I have a
problem, when I try to insert strings that contain special characters
(here I primarily think of quotes: ' and "). There _must_ be a smart
way to escape these characters. I'm looking for something precisely
like the Addslashes function in PHP; see this URL:

http://dk.php.net/manual/function.addslashes.php3

I've looked through the usenet archives but could only find the same
question, but with no answer.

Any help will be greatly appreciated,

Lars Høyrup Jensen




More information about the Python-list mailing list