可能重复: 终止Python脚本
我有一个简单的Python脚本,如果满足条件,我想停止执行.
例如:
done = True if done: # quit/stop/exit else: # do other stuff
本质上,我正在寻找与函数体中的'return'关键字等效的东西,它允许代码流退出函数而不执行剩余的代码.
python syntax scripting exit
exit ×1
python ×1
scripting ×1
syntax ×1