以下程序不会停止打印“退出”
myvar = str("")
while myvar.lower() != "quit":
myvar = raw_input()
print myvar
谢谢
答案 0 :(得分:3)
我会使用while True:
循环,然后在myvar.lower() == "quit"
:
# Loop continuously
while True:
# Get the input
myvar = raw_input()
# When converted to lowercase, if the input equals "quit"...
if myvar.lower() == "quit":
# ...break the loop
break
# If we get here, then myvar.lower() != "quit"
# So, print the input
print myvar
答案 1 :(得分:2)
只需更改订单。
myvar = raw_input()
while myvar.lower() != "quit":
print myvar
myvar = raw_input()