- ***I am a very very beginner programmer and you will see it soon. I just started to create my app as part of a personal goal in Python.
I read about SQLite3 and start to code with and example of creating a , everything goes fine until I run again my code and got an error showing me up that my dba is already created.
My question is: There is a code or instruction that permit me to verify whether my dba file is open or not.
code example:
c = conn.cursor()
Create table
c.execute('''CREATE TABLE stocks
(date text, trans text, symbol text, qty real, price real)''')
Insert a row of data
c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
Save (commit) the changes
conn.commit()
We can also close the connection if we are done with it.
Just be sure any changes have been committed or they will be lost.
conn.close()
Thanks.
