我已添加此功能,以确保用户实际上想要退出该程序.当你真的想要退出时它可以工作但是如果你想返回程序它只是循环语句:
def WantToQuit():
Quit = raw_input("Please enter y if you are sure you want to quit, if not press n to return ")
if Quit == 'y':
print ('')
elif Quit == 'n':
DisplayMenu()
return WantToQuit()
Run Code Online (Sandbox Code Playgroud)
别处:
elif Choice == 'q':
WantToQuit()
raw_input('Press enter key to continue ')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2684 次 |
| 最近记录: |