{
"item90": 12,
"item3": 0,
"item60": 35,
"item21": 15
}
{
"item90": 12,
"item3": 0,
"item60": 35,
"item21": 15,
"newstroke": 0
}
import sqlite3
con = sqlite3.connect(':memory:')
data = [
["item90", 12],
["item3", 0],
["item60", 35],
["item21", 15]
]
con.execute('''create table if not exists inv
(items text, number integer)'''
)
def print_db(con):
for row in con.execute('select * from inv'):
print(row)
def add_data(con, query, data):
con.executemany(query, data)
con.commit()
query = 'INSERT into inv values (?, ?)'
add_data(con, query, data)
print_db(con)
print('\nadd newstroke\n')
data = [['newstroke', 0]]
add_data(con, query, data)
print_db(con)
con.close()