#!/usr/bin/python3 # -*- coding: utf-8 -*- import pymysql db = pymysql.connect(host="222.73.129.15", port=31306, user="root", passwd="kepaiteng!QAZ", db="eq", charset="utf8") cursor = db.cursor() sqlname = input("请输入sqlname:") sqlstr = open("%s.sql" % (sqlname), "r", encoding="utf-8").read() sql = "update apisql set sqlstr =%s where sqlname =%s" err = cursor.execute(sql, (sqlstr, sqlname)) print(err) db.commit() db.close()