Name
exit
Synopsis
exit(arg
=0)
Raises a SystemExit
exception, which normally
terminates execution after executing cleanup handlers installed by
try
/finally
statements. If
arg
is an integer, Python uses
arg
as the program’s exit
code: 0
indicates successful termination, while
any other value indicates unsuccessful termination of the program.
Most platforms require exit codes to be between 0
and 127
. If arg
is not
an integer, Python prints arg
to
sys.stderr
, and the exit code of the program is
1
(i.e., a generic unsuccessful termination code).
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.