3 Votes Vote

Escape string Python for MySQL

Posted by topdog 525 days ago Questions| python mysql escape All

Hello,

I use Python and MySQLdb to download web pages and store them into database. The problem I have is that I can't save complicated strings into database because they are not escaped properly.

Is there a function in Python I can use to escape a string for MySQL? I tried with ''' (tiple simple quotes) and """, but it didn't work. I know that PHP has mysql_escape_string(), is something similar in Python?

Thanks,

Originally asked by: Laurențiu Dascălu on Stack Overflow

Discuss Bury


Who Voted for this Question