0
import mysql.connector
import sys
from PIL import Image
import base64
import cStringIO
import PIL.Image
db = mysql.connector.connect(user='root', password='abhi',
host='localhost',
database='cbir')
sql = 'INSERT INTO fgh(id,name) VALUES(%d,%s)'
args = (1,'abhi')
cursor=db.cursor()
cursor.execute(sql,args)
db.commit()
db.close()
錯誤的表:值插入使用python
Traceback (most recent call last):
File "C:\Users\Abhi\Desktop\cbir-p\New folder\co.py", line 16, in <module>
cursor.execute(sql,args)
File "C:\Python27\lib\site-packages\mysql\connector\cursor.py", line 472, in execute
"Wrong number of arguments during string formatting")
ProgrammingError: Wrong number of arguments during string formatting
幫我解決這個錯誤