I am v. stupid, please help

Michael P. Reilly Michael.P..Reilly at p98.f112.n480.z2.fidonet.org
Wed Jun 30 14:05:45 CEST 1999

From: "Michael P. Reilly" <arcege at shore.net>

Klaus Alexander Seistrup <kas at maps.magnetic-ink.dk> wrote:
: Newbie wrote:

:> name = input('What is your name : ')
:> This works for integers but not for strings,

: Use raw_input() instead.

The input() function takes Python expressions, so strings must be
surrounded in quotes, tuples with parentheses, etc.  You would would get
a NameError attempting to enter an unquoted string, because the string
would be taken as a variable name (referencing variables that do not
exist raise a NameError exception).

The raw_input() function returns the string as entered (as per UNIX
cooked mode).


More information about the Python-list mailing list