在爬到数据之后储存在mysql里,运行报错好像是说sql的语法出了问题,想请有经验的大手子看看是哪里出了问题
def save_to_mysql(data):
config = {
'host': 'localhost',
'port': 3306,
'user': 'root',
'password': 'Jia960418',
'database': 'python',
'charset': 'utf8'
}
conn = pymysql.connect(**config)
cursor = conn.cursor()
sql = '''
insert into LxhLol
(ChamName, killNum, DeathNum, wl, duration)
values
(%(ChamName)s,%(killNum)s,%(DeathNum)s,%(wl)s,%(duration)s)
'''
cursor.executemany(sql, data)
conn.commit()
cursor.close()
conn.close()
下面是报错:
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '),(),(),(),()),('Neeko','4','4','Defeat','24m 54s'),((),(),(),(),()),('Sion','5'' at line 4")