import sqlite3
import random
a = input("what is your username?")
b = ("what is your password?")
c = random.randint(100000,999999)
database = sqlite3.connect("login_username.db")
x = conn.cursor()
x.execute("""Username text,
Password text,
Login id integer
""")
conn.commit()
x.execute("INSERT INTO login_username VALUES (a, b ,c )")
conn.commit()
答案 0 :(得分:1)
你的连接变量是错误的。代码应该是这样的:
import sqlite3
import random
a = input("what is your username?")
b = ("what is your password?")
c = random.randint(100000,999999)
database = sqlite3.connect("login_username.db")
x = database.cursor()
x.execute("""Username text, Password text, Login id integer """)
database.commit()
x.execute("INSERT INTO login_username VALUES (a, b ,c )")
database.commit()