我需要能够在一个输入框中输入一个用户的全名,然后将其拆分为firstname和surname变量,这样这些变量就可以用来在数据库中搜索。然而,我有这个问题,因为这是我没有真正做过。感谢您的帮助
studentname = (StudName.get())
conn = sqlite3.connect('MyComputerScience.db')
c = conn.cursor()
firstName, lastName = studentname.split()
namesearchadd = (firstname, lastname,)
c.execute ("SELECT * FROM users WHERE FName = ? and SName= ? VALUES (?,?);", (namesearchadd,))
data = c.fetchall()
if len(data) == 0:
print ("whoops")
else:
Label(screen6, text = "Success", fg="GREEN").place(relx=0.101, rely=0.725, height=21, width=194)
firstName, lastName = studentname.split()
ValueError: not enough values to unpack (expected 2, got 0)
目前没有回答
相关问题 更多 >
编程相关推荐