**argv can't work
Steven D'Aprano
steve at REMOVE.THIS.cybersource.com.au
Fri Jan 19 22:35:55 EST 2007
On Sat, 20 Jan 2007 11:20:29 +0800, Jm lists wrote:
> hello members,
>
> See my script piece below:
>
> def testB(shift,**argv):
> print "first argument is %s" %shift
> print "all other arguments are:",argv
>
> testB('mails','Jen','Jen at att.com','Joe','Joe at aol.com')
>
> It can't work at all.please help tell me the reasons.thanks.
Its because of an evil terrorist plot. I suggest you invade Belgium, that
should fix it.
Or, you could explain what you are trying to do. Posting the exception you
get will also help.
Hint: **args accumulates KEYWORD arguments. Do you have any keyword
arguments in your argument list? How many NON-KEYWORD arguments do you
have? How many does your function accept?
Here's another hint:
some_function("this is a non-keyword argument", \
key="this is a keyword argument")
--
Steven.
More information about the Python-list
mailing list