【发布时间】:2019-01-10 19:01:41
【问题描述】:
我一直在研究一个 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 查询行。有人知道为什么会这样吗?
【问题讨论】:
-
如果你搜索“Python 输入教程”这个短语,你会发现比我们在这里的答案更能解释它的资源。
标签: python if-statement input