[Tutor] passing unknown no of arguments

spir denis.spir at free.fr
Thu Feb 5 15:02:58 CET 2009


Le Thu, 5 Feb 2009 08:57:15 -0000,
"Alan Gauld" <alan.gauld at btinternet.com> a écrit :

> 
> "amit sethi" <amit.pureenergy at gmail.com> wrote
> 
> > How do you pass arguments of unknown no. of arguments to a function.
> 
> search the docs for *args and *kwargs
> 

Or simply pass a tuple:

def myPrint(thing):
	print thing
thing_of_things = (1,'a',[True])
myPrint(thing_of_things)
==>
(1,'a',[True])

Denis
------
la vida e estranya


More information about the Tutor mailing list