代码拉取完成,页面将自动刷新
import sqlite3
class Db:
def __init__(self):
self.connection = sqlite3.connect("database/login.db")
self.createTable()
def createTable(self):
#connection = sqlite3.connect("login.db")
self.connection.execute("CREATE TABLE IF NOT EXISTS STUDENTS(USERNAME TEXT NOT NULL, PASSWORD TEXT)")
self.connection.commit()
def insertTable(self,user,password):
print(user)
print(password)
self.connection.execute("INSERT INTO STUDENTS VALUES(?,?)",(user,password))
self.connection.commit()
def loginCheck(self,username,password):
result = self.connection.execute("SELECT * FROM STUDENTS WHERE USERNAME = ? AND PASSWORD = ?",(username,password))
count = len(result.fetchall())
print(count)
#print(result.fetchall())
for data in result:
print("Username : ", data[1])
print("Password : ", data[2])
if(count > 0):
print("Login Successfully")
return True
else:
print("You havent registered yet")
return False
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。