Python does not save data in sqlite db

This is my code:

conn = sqlite3.connect(nnpcconfig.commondb)
cur = conn.cursor()
query = ['2124124', 'test2', 'test3', 'test4', 'test5']
cur.execute("insert into users(id, encpass, sname, name, fname) values (?, ?, ?, ?, ?)", query)
conn.commit
cur.execute("select * from users")
for row in cur:
    print row

This code works by returning a string to it. But it turns out that after the script is completed, the table will become understandable again! Where is the mistake? Of course, table users exist.

+5
source share
1 answer

You have another error: conn.commit insteadconn.commit()

+6
source

All Articles