方式一:更新 update #!/usr/bin/env python # coding=utf-8 import pymysql # Python 连接MySQL-本地测试 def main(): # 1.设置连接 db = pymysql.connect( host='localhost', port=3306, user='root', password='123456', db='test', charset='utf8') #2. 游标 cursor = db.cursor() # 3.写sql语句 sql =