Newbie Question - String Input
Peter Hansen
phansen at kaval.com
Sun Sep 3 02:25:02 EDT 2000
Look in the docs under python/Doc/lib/built-in-funcs.html and search for
"input". It will tell you that input() effectively calls eval() on
whatever is entered, which means it is directly evaluating the input as
an expression. Use raw_input() instead.
Sonic Hedgehog wrote:
>
> I am using Python on a Wintel machine and I am trying to get Python to
> accept string data. In the following program (a very basic program)
> Python accepts numerical data without any problems but will not accept
> any string data at all - the program crashes with the following error:
>
> Traceback (innermost last):
> File "hello.py", line9, in ?
> userName=input("What is your name? ")
> File "<string>", in line 0, in ?
> NameError: whatever_I_Entered
More information about the Python-list
mailing list