I am v. stupid, please help

Michael P. Reilly arcege at shore.net
Wed Jun 30 14:05:45 CEST 1999


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).

  -Arcege





More information about the Python-list mailing list