I'm having some trouble with the syntax in my script.
This works:
c.execute('SELECT * FROM restaurants WHERE address LIKE "%Yongsan%"')
But, I want the "%Yongsan%" to be replaced with a raw_input variable and I can't figure out the syntax of the '%' sign.
So, something along the lines of...
t = raw_input("Enter your District: ")
g = '%',t,'%',
c.execute('SELECT * FROM restaurants WHERE address LIKE ?', g)
But, when I execute the script I get the following error:
"sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied."
Aucun commentaire:
Enregistrer un commentaire