<分区>
Possible Duplicate:
python, basic question on loops
how to let a raw_input repeat until I wanna quit?
我需要一些 Python 方面的帮助。
我正在用 Py2.7.2 编写程序,但遇到了一些问题。
我目前的情况是这样的:
choice = raw_input("What would you like to do")
if choice == '1':
print("You chose 1")
elif choice == '2':
print("You chose 2")
elif choice == '3':
print("You chose 3")
else:
print("That is not a valid input.")
但是当用户选择1、2、3、4其中之一后,程序会自动退出。有没有一种方法可以让程序循环回来,以便它再次询问他们“你想做什么?”;这样这种情况会继续发生,直到用户退出程序。