如果python中的语句,则输入不会触发

时间:2019-01-10 19:01:41

标签: python if-statement input

我一直在研究python旧式计算机系统的乐趣,但是当我运行代码时,输​​入不会触发下一行代码。这是代码:

correctPassword = "testpassword"
guess = ""
guesses = ""
query = ""
run = 1
datacmd = ""
newfilename = ""
newtext = ""
filename = ""
appendtext = ""
helpcmd = ""
helpdcmd = ""
gameselect = ""
import time
import random
import datetime

while guess != correctPassword:
    guess = input("Password: ")

print ("loging in")

time.sleep(5)
print("Login complete.")
time.sleep(0.5)

while query == "":
    input("Please select one of the following queries by typing it into the box. data, helpme, games, date, close.")
    query = input
    #data section. read, write and edit files here
if query == "data":
        print("Welcome to data. For information on how to use your data section visit the help page.")
        input("command:")

特定行是if查询行。有人知道为什么会这样吗?

1 个答案:

答案 0 :(得分:0)

您不能这样做query = input。它必须是query = input("Please select...")。它应该与上面的guess = input("Password: ")相匹配。