On Sun, Aug 1, 2010 at 10:26 PM, Jason MacFiggen <jmacfig...@gmail.com> wrote:
> I was wondering how can I change sys.exit so if you use command line to run
> the program. it prompts a message asking if the user wants to exit instead
> of automatically just exiting?

You can't change sys.exit, but you can build something yourself. You
have raw_input to ask the user something, and an if statement to make
a decision based on that input. You should be able to figure something
out.

One other point: if you just want to exit, you don't have to call
sys.exit really, you can just let the script end naturally (break out
of the while loop and it'll end by itself). sys.exit is only really
useful if you want a special exit status.

Hugo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to