我正在使用查询mycursor.execute("insert into adb (date, lecture) values (%s,%s)", f_date, coun)
该值未插入,并且将打印输出作为-1记录插入
coun=0
mycursor = mydb.cursor()
mycursor.execute("Select count(*) from adb")
myresult = mycursor.fetchone()
for a in myresult:
coun = int(a)
coun=coun+1
now = datetime.datetime.now()
f_date = now.strftime('%Y-%m-%d')
mycursor.execute("insert into adb (date, lecture) values (%s,%s)", f_date, coun)
mydb.commit()
print(mycursor.rowcount, "record inserted.")