博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

Posted on 2013-07-24 08:58  钟悍  阅读(3402)  评论(1编辑  收藏  举报

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
.