Self terminate a python program

Ben Finney bignose+hates-spam at benfinney.id.au
Tue Nov 15 17:53:07 EST 2005


Ernesto <erniedude at gmail.com> wrote:
> how do you self terminate a python program from within the code?
> something similar to exit(0) in C.

Inspection and control of the Python runtime system is mostly within
the 'sys' module.

    <URL:http://docs.python.org/lib/module-sys.html>

In this case, 'import sys; help(sys.exit)' will be of assistance.

-- 
 \            "I always had a repulsive need to be something more than |
  `\                                           human."  -- David Bowie |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list