HOWTO: exit

Skip Montanaro skip at pobox.com
Sun Jul 22 20:57:16 CEST 2001


    adam> how do I exit from a script?

You can call sys.exit() or raise the SystemExit exception:

    beluga:skip% python
    Python 2.1.1c1 (#13, Jul 10 2001, 17:30:38) 
    [GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> raise SystemExit
    beluga:skip% python
    Python 2.1.1c1 (#13, Jul 10 2001, 17:30:38) 
    [GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> sys.exit()
    beluga:skip% 


-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list