I would like to use a dictionary to insert values into a table, how would I do this?
import sqlite3 db = sqlite3.connect(\'local.db\') cur = db.cursor() c
dictionary = {'id':123, 'name': 'Abc', 'address':'xyz'} query = "insert into table_name " + str(tuple(dictionary.keys())) + " values" + str(tuple(dictionary.values())) + ";" cursor.execute(query)
query becomes
insert into table_name ('id', 'name', 'address') values(123, 'Abc', 'xyz');