Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def save_dict (dic):
- for keyword,subdic in dic.items():
- try:
- with conn:
- #print("\'{}\'".format(keyword))
- cur.execute('CREATE TABLE IF NOT EXISTS [{}] (word TEXT,value INT, unique(word));'.format(keyword))
- except db.OperationalError as oe:
- print("OperationalError:",oe)
- for word,value in subdic.items():
- try:
- with conn:
- cur.execute('INSERT INTO [{}] VALUES (?,?);'.format(keyword),(word,value))
- except db.IntegrityError as ie:
- pass#print("Integrity error:",ie)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement