I did a search with Python and got the result below but having troubles saving it to a table in SQLite. Table having 3 Columns (category, name, id)
Code:
data = [{u'category': u'Local Business',
u'category_list': [{u'id': u'145887745471348', u'name': u'Train Station'}],
u'id': u'129926257075048',
u'name': u'Southampton the Fit Student Central!'},
{u'category': u'Local Business',
u'category_list': [{u'id': u'2500', u'name': u'Local Business'}],
u'id': u'151910741511395',
u'name': u'Student Hell Train'},
{u'category': u'Local Business',
u'category_list': [{u'id': u'192119584190796', u'name': u'Event'}],
u'id': u'159561157587886',
u'name': u'Student Ambassador Training'}]
stmt = "insert into Student_Mentors (category, name, id) values ({category}, {name}, {id})".format(**data)
con.executemany(stmt, data)
con.commit()
I get the following error...
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-174-58d2f1a67f61> in <module>()
13
14
---> 15 stmt = "insert into Student_Mentors (category, name, id) values ({category}, {name}, {id})".format(**data)
16 con.executemany(stmt, data)
17 con.commit()
TypeError: format() argument after ** must be a mapping, not list
Not sure how to make it a mapping
Aucun commentaire:
Enregistrer un commentaire