代码如下:
class Update:
def __int__(self, table, key, header, date):
self.table = table
self.key = key
self.date = date
self.header = header
def update_date(self):
conn = pymysql.connect(host="localhost", port=3306, user="root", password="123456", charset="utf8",
db="冀熙科技管理系统")
cursor = conn.cursor()
sql = '''update {0} set {1}='{2}' where id='{3}';'''.format(self.table, self.header, self.date, self.key)
cursor.execute(sql)
conn.commit()
cursor.close()
conn.close()
a = Update
a.update_date(table='project_information', key='202101', header='step', date='关门')
错误显示为:update_date() got an unexpected keyword argument 'table'