[Tutor] The meaning of "raw_input"

Magnus Lyckå magnus@thinkware.se
Fri May 30 14:56:01 2003


At 19:32 2003-05-30 +0200, guillaume wrote:
>If I let raw_input like that, no Josh or anything else.
>It's a variable,I think,but I don't understand her roll :-(

The raw_input function prompts you for input and
returns that as a string. This certainly worked for
me. You don't need idle. Just open a "DOS prompt"
and run the program.

This is what it looked like for me:

C:\temp>type test.py
print "Halt!"
s = raw_input("Who Goes there? ")
print "You may pass,", s

C:\temp>python test.py
Halt!
Who Goes there? Magnus
You may pass, Magnus

I types my name and pressed [Enter] after the program
had printed "Who Goes there?"


--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program