[Tutor] Well...
Scott Widney
SWidney@ci.las-vegas.nv.us
Fri Dec 20 11:32:03 2002
> > -Why is it that when a program finishes up, it immediately
> > quits? Some programs have outcomes I'd like to view...
> > How can I make it pause (like in DOS)?
> >
>
> there are several ways to do this. to make a program pause
> for a number of seconds, you can do this:
>
> import time
> time.sleep(5)
>
> obviously, the import line goes at the start of your program,
> and the time.sleep line goes at the end. in fact, it should
> be the last command which is called.
>
> or, you can do this, which asks the user to hit enter:
>
> raw_input('Hit Enter to Exit Program')
>
I know that python also has the -i commandline option, which puts you into
interactive mode when the program ends or if there is an exception. I've
used it a few times during testing. What are the potential pitfalls of using
it?
Scott