Sep-13-2017, 09:19 AM
I want to insert my data into my table using variables. For example i want to insert data into table using ( data = input ("") )
What should i do?
What should i do?
import sqlite3 as sq3 conn = sq3.connect("Hacker.db") #conn.execute('''CREATE TABLE Hack # (ID INT PRIMARY KEY NOT NULL, # NAME TEXT NOT NULL, # AGE INT NOT NULL);''') conn.execute("INSERT INTO Hack (ID,NAME,AGE) VALUES (1, 'PAUL', 17) "); conn.execute("INSERT INTO Hack (ID,NAME,AGE) VALUES (2, 'PAUL', 17) ") cursor = conn.execute("SELECT ID,NAME,AGE from Hack") for row in cursor: print ("ID = " + str(row[0]) ) print ("NAME = " + str(row[1])) print ("AGE = " + str(row[2])) conn.close()