Is there any analogue of EXIT_SUCCESS and EXIT_FAILURE macros in Python 2.7.6? If yes, how can I use it?
The value of EXIT_SUCCESS is defined in stdlib. h as 0; the value of EXIT_FAILURE is 8. This function is also available to C applications in a stand-alone Systems Programming C (SPC) Environment.
If the value of status is EXIT_FAILURE , an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.
Yes, use os.EX_OK
. (Unix only)
As the docs say:
Note: The standard way to exit is
sys.exit(n).
You can supply an exit code listed—of the EX_
prefix—here, to sys.exit(n)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With