MySQLdb TypeError: %d format: a number is required, not str问题解决

来源:互联网 发布:晨曦清单计价软件 编辑:程序博客网 时间:2024/06/10 16:39
遇到问题: TypeError: %d format: a number is required, not str
解决办法: 传给sql的变量写对格式就行了. sql里不需要对对应的变量写%d,只写%s就可以了

遇到问题: (1146, "Table 'database.'table_name'' doesn't exist")
解决办法: 不用cursur.execute(sql,param)方式,改成拼串方式写. str写成 column = '%s' , int写成 column = %s. 所有的int不需要加单引号. str需要单引号
0 0
原创粉丝点击