方法一: import sys sys.exit() # 退出当前程序,但不重启shell 方法二: exit() # 退出当前程序,并重启shell 方法三: quit() # 与exit()效果一样,退出并重启shell