# 引入数据库
import python
a = input('请输入名字:')
while a != '..':
b = input('请输入新的IMEI:')
# 连接数据库
db = MySQL.connect(host="127.0.0.1", port=3306, user="root", passwd="123456", db="python")
cursor = db.cursor()
# SQL语句
sql1 = '''UPDATE python SET IMEICode='%s' WHERE uname='%s'
''' % (b, a)
sql2 = '''update Python set 备注='已更新' where uname='%s'
''' % a
try:
# 执行SQL语句
cursor.execute(sql1)
cursor.execute(sql2)
db.commit()
print('修改成功')
except Exception as err:
db.rollback()
print(err)
# 关闭数据库
db.close()
a = input('请输入下一个名字:')
这是我写的将数据记录到navicat的代码,但是一运行就出现这样
大佬们求助