嗨,当我使用sql更新数据时,出现字符串错误。请帮助我。
这是我的错误:
TypeError: not enough arguments for format stringimport pymysql.connect string error
我的代码如下:
db = mysql.connector.connect(user='root', password='1234', host='localhost', database='sosyalbe')
cursor = db.cursor()
cursor.execute("SELECT * FROM siparisler WHERE siparis_durum ='İptal'")
order = cursor.fetchone()
id = order[0]
dss = 10
cursor.execute("UPDATE siparisler SET urun_baslangic = '%s' WHERE order_id ='%s'" %dss % id) #errror
cursor.execute("UPDATE siparisler SET urun_baslangic = (?) WHERE id = (?)" (dss, id)) #ERROR
请帮助!
答案 0 :(得分:0)
您在参数的字符串和元组之间缺少逗号。另外,请注意,lines = cv2.HoughLines(edges, 1, np.pi / 180, 220)
for line in lines:
rho, theta = line[0]
print(rho, theta)
应该不要用引号引起来,因为它们不是字符串文字:
%s