"Jm lists" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> 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','[EMAIL PROTECTED]','Joe','[EMAIL PROTECTED]')
>
> It can't work at all.please help tell me the reasons.thanks.
>
You have too many asterisks before argv. Use just one, like this:
def testB(shift,*argv):
print "first argument is %s" %shift
print "all other arguments are:",argv
testB('mails','Jen','[EMAIL PROTECTED]','Joe','[EMAIL PROTECTED]')
Two asterisks signifies keyword arguments, like this:
def f(**c):
for k,v in c.items():
print k,v
f(a=1,b=2)
--
http://mail.python.org/mailman/listinfo/python-list