raw_input
Alex Martelli
aleaxit at yahoo.com
Wed Jun 20 15:06:29 EDT 2001
"Brendhan Horne" <brendhanhorne at bellsouth.net> wrote in message
news:_x5Y6.18111$9r1.1628947 at e3500-atl1.usenetserver.com...
> >>> 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.
You did not bind the result of raw_input to any variable, in
particular not to one named 'name'. Change the first
statement to:
>>> name = raw_input("Enter your name:")
Alex
More information about the Python-list
mailing list