python3 更新mysql中部分数据;

import pymysql
ecshop=pymysql.connect('localhost','root','root','ecshop')
curs=ecshop.cursor()
sql="update ecs_user_address set tel='19945020111' where consignee='an' and email='8998@qq.com'"
try:
curs.execute(sql)
ecshop.commit()
except:
conn.rollback() #发生错误时回滚
print('update wrong')
ecshop.close()

posted on 2019-12-26 21:16  星空6  阅读(1022)  评论(0编辑  收藏  举报

导航