aleaxit at yahoo.com
Sun Nov 12 15:59:49 CET 2000
"Brendhan Horne" <brendhanhorne at bellsouth.net> wrote in message
news:tUvP5.1166$Vi4.8005 at news4.mia...
> Alex wrote
> > Or just place a rawinput at the end (with some prompt such as
> > "press Enter to terminate") so the consolewindow will wait before
> > disappearing.
> Please explain further. What is this rawinput??? How do I enter it???
raw_input (the underline is needed -- sorry for dropping it in the
above-quoted text!-) is a built-in function to let the user input any
newline-terminated string and return it. It takes an optional arg,
the prompt to be displayed (default, no prompt).
So, if you have a Python script such as, say:
print "2+2 is",2+2
and, under Windows, it's running (when doubleclicked as an icon)
but its output console is disappearing too fast, you can fix that by
adding, as the last line of the script:
raw_input("Press Enter to terminate...")
This will ensure the console does not disappear until the user
hits Enter at the prompt (we don't care, here, what else he may
be inputting, so we don't assign the raw_input result to any
variable... but the call still makes the program wait before
ending until Enter IS hit, even though the result is then discarded).
More information about the Python-list