Why should input(prompt="hello:") fail?
Peter Hansen
peter at engcorp.com
Mon Nov 24 12:09:26 EST 2003
zhi wrote:
>
> Really confused, when I use keyword style argument as following:
>
> >>> input(prompt="hello")
>
> Traceback (most recent call last):
> File "<pyshell#52>", line 1, in -toplevel-
> input(prompt="hello")
> TypeError: input() takes no keyword arguments
>
> While the library reference says the function is: input( [prompt])
> so, it should work.:(
No, it shouldn't. The argument is not shown with a name, so you
are supposed to use just a position argument, as in input('hello').
Note however that input() is a poor choice for serious work: you
should quickly get past the point of wanting to use it and learn
why raw_input() is a better choice.
-Peter
More information about the Python-list
mailing list