Help formatting a mysql query string
Pierre-Frédéric Caillaud
peufeu at free.fr
Sat Jun 26 07:44:35 EDT 2004
> sqlquery = "INSERT INTO %s", tablename + " values(%s,%s,%s)", datavalue"
- what are the "," doing here if you are trying to build a string ?
- you should use the python povided way which is better (yours looks like
php)
cursor.execute( "INSERT INTO %(tb)s VALUES(%(a)s,%(b)s,%(c)s)",
{ 'tb':tablename, 'a':first data, 'b':second data, etc... }
More information about the Python-list
mailing list