得到了JSON数据,想插入到SQLite数据库中,Python 语句怎么写?
我是这么写的,但是报错,想问问写的对不对,正确的该怎么写?importsqlite3data=[{"fid":xxx,"name":232},{"fid":yyy,"na...
我是这么写的,但是报错,想问问写的对不对,正确的该怎么写?
import sqlite3
data=[{"fid":xxx,"name":232},{"fid":yyy,"name":2we2},{"fid":zzz,"name":2w2},{"fid":iii,"name":212}]
cx=sqlite3.connect('friend.db')
cu=cx.cursor()
cu.execute('insert into friendslist(fid,name) values (%s)'%data)
报错:OperationalError: near……: syntax error 展开
import sqlite3
data=[{"fid":xxx,"name":232},{"fid":yyy,"name":2we2},{"fid":zzz,"name":2w2},{"fid":iii,"name":212}]
cx=sqlite3.connect('friend.db')
cu=cx.cursor()
cu.execute('insert into friendslist(fid,name) values (%s)'%data)
报错:OperationalError: near……: syntax error 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询