python学习笔记
sys.exit([args])的参数解析
The optional argument arg can be an integer giving the exit status (defaulting to zero), or another type of object. If it is an integer, zero is considered “successful termination” and any nonzero value is considered “abnormal termination” by shells and the like.
意思就是参数为数字的时候,和 shell 退出码意义是一样的,sys.exit(2)和sys.exit(1)只是为了区分结束原因
0:成功结束1:通用错误2:误用Shell命令

浙公网安备 33010602011771号