运行时出现这个报错
in saveData2DB
values(%s)'''%','.join(data)
TypeError: sequence item 2: expected str instance, list found
原代码是这样的
def saveData2DB(datalist,dbpath):
init_db(dbpath)
conn = sqlite3.connect(dbpath)
cur = conn.cursor()
for data in datalist:
for index in range(len(data)):
data[index] = '"' + data[index] + '"'
sql = '''insert into movie250(
info_link,pic_link,cname,ename,score,rated,instroduction,info)
values(%s)'''%",".join(data)
print(sql)
# cur.execute(sql)
# conn.commit()
cur.close()
conn.close()
我找了很久,还是不知道怎么解决这个问题。请各位老哥帮忙,这里应该怎么改