how to assign an sql value to this python variable <p>ok i got this as simple as i can, everythings working and i need one last thing before I'm done with this issue i am using sqlite3 module in python i also have very limited sql expierance</p> <p>the problem- i need to take the only value out of an sql table; the tablename is saves and the row id is 0 the name of the row is lvl. i need to then assign this as the value of the python variable lvl. Then on closure of the program i need to update the sql table with the current value of the python variable lvl (it will take the place of the data i just retrieved--there will also be numerous operations in between).</p> <p>My code for assigning the value of the python Variable</p> <pre><code>conn = sql.connect('databaserm/database') curs = conn.cursor() curs.execute('SELECT 0 FROM saves') lvl = curs.fetchone() conn.commit conn.close() </code></pre> <p>after running this i get the output None</p> <p>and my code for adding data to the database on closure</p> <pre><code> elif choice == q: if choice == q: cn = sqlite3.connect('/databaserm/database') curs = cn.cursor() curs.execute('INSERT INTO saves (lvl) VALUES (?)', lvl) cn.commit cn.close() loop1 = 0 loop = 10000 print "Goodbye!" sys.exit(0) </code></pre> <p>after running this with a preloaded database and the previous code ommited i get a connection error</p> <p>i would be overjoyed at any help i'm offered and hope to work out a solution to this soon </p>