I am creating table in my database. I am also inserting values into that table. So I am running the .py file in terminal it is not printing the inserted values. Its working in shell but with editor it doesn't ? I am writing this code to create table:
import sqlite3
conn = sqlite3.connect('raman.db')
c = conn.cursor()
c.execute("CREATE table raman(ATOMIC NUMBER INT, SYMBOL TEXT, ROW INT , COLUMN INT)")
c.execute("INSERT INTO raman VALUES(1,'H',1,'1')");
conn.commit()
Now if i want to print those inserted values it doesn't work in editor. but with shell its working. i am writing this to print :
import sqlite3
conn = sqlite3.connect('raman.db')
c = conn.cursor()
for row in c.execute('SELECT * FROM raman'):
conn.commit()
See Question&Answers more detail:os