Python:Some special method for escaping single quotes and double quotes from a string variable
python, python-2.7, sqlite
Solution
You're doing it wrong.
cursor.execute("INSERT ... (?, ?, ?)", (var1, var2, var3))
Problem
I am inputting a variable of datatype string in Sqlite database with my Python script.So whenever i am inserting that value i am getting Sqlite error: ``` sqlite3.OperationalError: near "s": syntax error ``` My variable string is something like this: ``` file_path=r'James Bond 007 - 07 - On Her Majesty's Secret Service (1969)' ``` Actually i am getting this file name directly from `os.walk` so i can't escape that single string by putting backslash manually.I want some string method which automatically escapes the content inside string.