raw_input

Matthew Dixon Cowles matt at mondoinfo.com
Wed Jun 20 14:15:50 EDT 2001


On Wed, 20 Jun 2001 14:07:11 -0400, Brendhan Horne
<brendhanhorne at bellsouth.net> wrote:

>>> raw_input ("Enter your name:")
Enter your name:Brendhan
'Brendhan'
>>> print name
Traceback (innermost last):
  File "<pyshell#7>", line 1, in ?
    print name
NameError: There is no variable named 'name'

>Okay What did I do wrong it should have printed my name after the
>print name command.

Brendhan,
You didn't tell Python that you wanted the value that you entered
to be associated with the name "name".

>>> name=raw_input("Enter your name:")
Enter your name:Matt
>>> name
'Matt'

Regards,
Matt



More information about the Python-list mailing list