【发布时间】:2019-03-21 21:57:21
【问题描述】:
所以对于我的项目,我试图让用户在文本框中输入一些内容,如果它等于存储在数据库中的内容,那么它将告诉他们这是真的。然而,目前即使输入了正确的内容,它也会返回 false。这是获取答案、返回和比较的部分的当前代码:
def submit():
answerA=entry_A.get()
answerB=entry_B.get()
answerC=entry_C.get()
answerD=entry_D.get()
answerE=entry_E.get()
answerF=entry_F.get()
print(answerA,", ",answerB,", ",answerC,", ",answerD,", ",answerE,", ",answerF)
labelA=cursor.execute\
("select labelA from diagramLabels where diaName == 'plantCell'").fetchall()
con.commit()
if labelA == answerA:
print("Answer A is correct")
else:
print("Answer A is false")
And this is the result it gives in Idle, along with what's in the database
请告诉我我做错了什么。
【问题讨论】:
标签: python sql tkinter sqlite python-3.4