[Tutor] The meaning of "raw_input"

Alan Gauld alan.gauld@blueyonder.co.uk
Fri May 30 19:45:03 2003

> It's a variable,I think,but I don't understand her roll :-(

It's called a function, you'll learn about them later in Josh's tutor
I suspect.

> Unfortunately I'm not using IDLE (I'm downloading it),
> I'm working on W$

If you have Python you already have IDLE (or Pythonwin if you
got the Activestate version - they are effectively the same)

Look for the python GUI in your Python menu

> Could u help me to understand clearly what is an input.

An input in this case is where the program stops and waits
for you to type something followed by ENTER.

If you haven't used MS DOS before then it will probably seem strange.
Bascally Python will run in a Command Prompt or MS DOS window.
It will print things into the window and when it requests input
you can type responses - just like using the >>> prompt in
Python itself - I hope you have somehow gotten to the >>> prompt
by now?!

Technically Python writes to "Standard Output" or stdout and
reads from "Standard Input" or stdin. raw_input() is so called
because it just reads the raw keystrokes you type whereas input()
tries to interpret the keystrokes and return either a number
or some other Python value.

Thus when you run your Python program you need to watch the
window in which it runs and read the prompts. When asked just
make sure the window has focus (click its title bar with the mouse)
and type your reply at the keyboard. You should see it echoed
in the window and when you hit ENTER Python will process the
data you entered.

Sorry if that seems unnecessarily patronising but I have
discovered from readers of my tutor that many Windows users
have never seen a command prompt system before and the whole
concept is new to them.

Alan g.