Waiting for return

Remco Gerlich scarblac-spamtrap at pino.selwerd.nl
Mon Sep 4 13:07:04 EDT 2000


Kevin Breit wrote in comp.lang.python:
> In article <slrn8r6deg.nq.matt at happy-hour.mondoinfo.com>,
> matt at mondoinfo.com (Matthew Dixon Cowles) wrote:
> > On Sun, 03 Sep 2000 23:10:14 -0600, Kevin Breit
> > <battery841 at remove.for.no.spam.mypad.com> wrote:
> > 
> >> Hey I am writing a console application in .py.  I want to get the
> >> following effect: Please press return to continue
> >> <waits for return keystroke>
> >> If you can help, it would be very appreciated.  Thanks a lot!
> > 
> > Kevin, You want something like:
> > 
> > dummy=raw_input()
> And what does this all mean?  Is dummy a variable?  Do I put anything in
> raw_input()?

raw_input() is a function that waits for the user's input, terminated by a
<return>, and returns it (as a string).

dummy is a variable, its value will be the string that the user typed in
(probably just '' in your case). Since it won't be used anymore, it's called
'dummy' in this example.

You can give raw_input an argument, a string that it will print before it
waits for input; you could do

dummy = raw_input("Please press return to continue")

too, so you don't have to print it yourself.
-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
  Murphy's Rules, "Suicide on the steppes":
   The Russian Civil War was designed to simulate chaotic conditions in
   Russia in 1917. Players can get points for attacking their own units.



More information about the Python-list mailing list