这是我的代码:
import sqlite3
CreateDB = sqlite3.connect('Login.db')
querycurs = CreateDB.cursor()
def createTable():
querycurs.execute('''CREATE TABLE Database (id INTEGER PRIMARY KEY, user TEXT, passw TEXT)''')
print "Done"
def NewElement(new_user,new_pass):
querycurs.execute('''INSERT into Database (user,passw) values (?,?)''',(new_user,new_pass))
def SelectElement(new_user):
Pass = querycurs.execute('''SELECT passw FROM Database WHERE user = (?) ''',[new_user])
print Pass
createTable()
NewElement("Abhishek","Mitra")
SelectElement("Abhishek")
通过值打印为;
<sqlite3.Cursor object at 0x0000000002A9FE30>
我遵循了教程中给出的确切脚本。