检查了语句,也看了数据库,都没有int类型了,最后发现:
'''数据库配置''' conn = MySQLdb.connect( host='localhost', port=3306, -------------------------------port接口这是数字!!! user='root', passwd='123456', db='python', charset='utf8' ) cur = conn.cursor() cur.execute("insert into weather(cityDate,week,img,temperature,weather,wind) values(%s,%s,%s,%s,%s,%s)", (cityDate,week,img,temperature,weather,wind)) # cur.execute("insert into weather(cityDate,week,img,temperature,weather,wind) values('1','1','1','1','1','1')") cur.close() conn.commit() conn.close()