import pymysql import random import datetime import random # 创建数据库连接 connection = pymysql.connect( host='192.168.0.244', port=3300, user='root', password='hxyd1109', database='school_server', charset='utf8' ) # 创建游标对象 cursor = connection.cursor() orgianl = {'id': 828, 'tea_name': '彭兰英', 'sex': 2, 'phone': '15198039323', 'type': 6, 'grade_id': None, 'class_id': None, 'user_name': 'ptszxbr9023', 'team_id': '110', 'pid': None, 'serial_no': '1336827486', 'openid': None, 'tea_no': 'ptszxbr9023', 'wx_phone': '15198039323', 'user_id': None, 'department_id': None, 'zt_teacher_uuid': None, 'hire': '职工', 'power': '门卫安保', 'class_type_name': None, 'hire_id': 98, 'flag': None, 'state': 1, 'sync_source': 'local'} sql = f""" UPDATE `school_server`.`teacher` SET `tea_name` = '彭兰英' WHERE `id` = 828; """ cursor.execute(sql) connection.commit() cursor.close() connection.close()