Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def definition():
- import sqlite3
- global db
- global cursor
- global dbpath
- dbpath = "/home/nikoh/PycharmProjects/gestionale/db/HME.db"
- db = sqlite3.connect(dbpath)
- cursor = db.cursor()
- def insert(tablename, posted):
- definition()
- keys = list(posted.keys())
- values = list(posted.values())
- keys = str(keys)[1:-1]
- with db:
- cursor.execute("INSERT INTO "+tablename+"("+keys+")"+" VALUES(?, ?, ?)", values)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement