Python: inserting double or single quotes around a string
Posted
by Jessy
on Stack Overflow
See other posts from Stack Overflow
or by Jessy
Published on 2010-03-13T16:20:20Z
Indexed on
2010/03/13
16:25 UTC
Read the original article
Hit count: 224
Im using python to access a MySQL database and im getting a unknown column in field due to quotes not being around the variable.
code below:
cur = x.cnx.cursor()
cur.execute('insert into tempPDBcode (PDBcode) values (%s);' % (s))
rows = cur.fetchall()
How do i manually insert double or single quotes around the value of s?
I've trying using str()
and manually concatenating quotes around s
but it still doesn't work.
The sql statement works fine iv double and triple check my sql query.
© Stack Overflow or respective owner