creating multiply arguments for a method.

Fredrik Lundh fredrik at pythonware.com
Sun Aug 27 10:14:31 EDT 2006


noro wrote:

> Let say that during runtime i need to pass 4 arguments, each is a list,
> creating a set of lists and passing it to the method wont word since
> the interpartor thinks it is only 1 argument the contain a reference to
> a "list of lists", instede of number of arguments, each is a list.

 >>> def func(*args):
...     print "got", len(args), "argument(s)"
...
 >>> args = [[1, 2, 3, 4], [5, 6, 7, 8]]
 >>> func(args)
got 1 arguments
 >>> func(*args)
got 2 arguments

</F>




More information about the Python-list mailing list