Skip to main content
 首页 » 编程设计

python之关于 python mysqldb TypeError

2025年05月04日30grandyang

不知道是什么问题。 你能帮忙吗?

cur = conn.cursor() 
sql = "select count(*) from sbox_trig where date > CURDATE() and name ='bw109nocd%2Ezip'" 
cur.execute(sql) 
 
Exception Type: TypeError 
Exception Value: not enough arguments for format string 

请您参考如下方法:

将 % 百分号加倍:

sql = "select count(*) from sbox_trig where date > CURDATE() and name ='bw109nocd%%2Ezip'" 

%2E 部分被解释为 string formatter for a floating point number否则。