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()
越努力,越幸运!!!
good good study,day day up!!!