python os._exit(0) and sys.exit(0)

os._exit(n)

Exit to the system with status n, without calling cleanup handlers, flushing stdio buffers, etc. Availability: Macintosh, Unix, Windows.

Note: The standard way to exit is sys.exit(n)_exit() should normally only be used in the child process after a fork().


sys.exit(n)

Exit from Python. This is implemented by raising the SystemExit exception, so cleanup actions specified by finally clauses of try statements are honored, and it is possible to intercept the exit attempt at an outer level
.

你可能感兴趣的:(python)