输入banner图图片脚本导航/分类

python中sql语句的占位符



TypeError: %d format: a number is required, not str"

 

MySQLdb的字符串格式化不是标准的python的字符串格式化,

应当一直使用%s用于字符串格式化

 

python中无论整数,字符串占位符都为  %s,且不需加单引号

sql="insert into myauth_perm(permname, permurl, permdemo, parentid) values(%s, %s, %s, %s)"
cur.execute(sql,[html_permname, html_permurl, html_permdemo,html_parentid])

 

python中sql语句的占位符

标签:字符串   url   number   perm   html   modules   报错信息   mysqld   使用