input

Mathias Mølster Lidal mathiasm at pvv.org
Tue Nov 13 13:26:37 EST 2001


"Andreas Penzel" <mail at andreas-penzel.de> writes:

> Hello NG!
> 
> I am new in the world of python.
> First I made some Tuturials, but what I could not find:
> 
> How to get an input from the console?
> 
> for example: the program starts, givs some prints on the screen and now I
> want an input from the user like this:  print "please type your name:"
> 
> the input should get into to a variable like user_input = ???
> 
> I hope I could explain the problem, that everyone can follow my minds.
> 

You can use the built-in function raw_input(), like this:
user_input = raw_input("please type your name:")

this will print the string "please type your name", recieve the input and
place it int user_input.

raw_input is documented here: 
http://www.python.org/doc/current/lib/built-in-funcs.html


Mathias Lidal



More information about the Python-list mailing list