**argv can't work
rzed
rzantow at gmail.com
Fri Jan 19 22:33:26 EST 2007
More information about the Python-list mailing list
Fri Jan 19 22:33:26 EST 2007
- Previous message (by thread): **argv can't work
- Next message (by thread): **argv can't work
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Jm lists" <practicalperl at gmail.com> wrote in news:mailman.2928.1169263231.32031.python-list at python.org: > 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. > 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','Jen at att.com','Joe','Joe at aol.com') Two asterisks signifies keyword arguments, like this: def f(**c): for k,v in c.items(): print k,v f(a=1,b=2)
- Previous message (by thread): **argv can't work
- Next message (by thread): **argv can't work
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list