報錯信息:"File"/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 151, inexecute query = query % db.literal(args)
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])
