Why should input(prompt="hello:") fail?

Paul Metzer pmetzger at bellsouth.net
Mon Nov 24 18:12:54 CET 2003


Input is for gathering user input. 

Something like:
 d = Input('enter your data:')

It will then ask the user for the data and pause and then set the data
to what ever variable you give it. In this case d. if you did a print d
you would then echo what you entered in. To answer your question, the
problem is the "prompt=". It's taking that as a keyword, which input
just doesn't have need for, since it's just there to take user input in
a console app. 

If you are new to python, I would highly recommend you picking up a copy
of the python 2.1 bible. It's not the cheapest book in the world, but
it's a really good place to start. Not to mention it's the only book I
have found that has anything at all on wxPython.  

========================================================================
==================================================
"Seek for the Sword that was broken:
 In Imladris it dwells;
 There shall be counsels taken
 Stronger than Morgul spells.
 There shall be shown a token
 That Doom is near at hand
 For Isildur's Bane shall waken,
 And the Halfling forth shall stand."
                                   -- From The Lord of The Rings
                                       "The Fellowship of the Ring"
                                               J.R.R. Tolkien
========================================================================
==================================================
 

> -----Original Message-----
> From: python-list-bounces+pmetzger=bellsouth.net at python.org
> [mailto:python-list-bounces+pmetzger=bellsouth.net at python.org] On
Behalf
> Of zhi
> Sent: Monday, November 24, 2003 10:32 AM
> To: python-list at python.org
> Subject: Why should input(prompt="hello:") fail?
> 
> 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.:(
> 
> I am using python 2.3 for windows.
> Have anyone tried this?
> I am new to python, please help me, thanks.
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list