我有一个工作的python脚本,它从sqlite3db检索数据。我需要把它转换成一个mysql数据库,这里的第一行让我很难过:
PRODUCT_CODE_ID = "SELECT id FROM localsite_productcode WHERE localsite_productcode.product_code=?"
cur.execute(PRODUCT_CODE_ID,(product_code,))
当我尝试使用mysql时,会出现以下错误:
Traceback (most recent call last):
File "gen-csv.py", line 85, in <module>
cur.execute(PRODUCT_CODE_ID,(product_code,))
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 151, in execute
query = query % db.literal(args)
TypeError: not all arguments converted during string formatting
我做错什么了?你知道吗
我不认为MySQL的dbapi支持
?
作为占位符-只要试着%s
。你知道吗相关问题 更多 >
编程相关推荐