A simple question: How to exit from a python script? Just like the exit() in C++

Sean 'Shaleh' Perry shalehperry at attbi.com
Wed Nov 20 23:01:26 EST 2002


On Wednesday 20 November 2002 19:54, Wang Hanbo wrote:
> Hi,
>
>          I have a simple question as is written in the header, how can I
> exit from a python program using a call such as "exit()" in C++?
>
>          I am a novice on this list, and also a rookie on python
> language, all of you answers will be my best impetus!
>          Thanks
>
>
> Hanbo
> 2002-11-21

a) import sys
   sys.exit() # takes the same parameter C++'s exit() takes

b) raise SystemExit # for when you do not want to import sys




More information about the Python-list mailing list