Python退出主程序

import sys
sys.exit(1)

 exit函数的使用方法

Exit the interpreter by raising SystemExit(status).

If the status is omitted or None, it defaults to zero (i.e., success).
If the status is an integer, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).

你可能感兴趣的:(代码,python)