Passing ints to a function

Benjamin Kaplan benjamin.kaplan at case.edu
Sat Jun 9 01:55:24 CEST 2012


On Fri, Jun 8, 2012 at 7:41 PM, stayvoid <stayvoid at gmail.com> wrote:
> Hello,
>
> I want to pass several values to a function which is located on a
> server (so I can't change its behavior).
> That function only accepts five values which must be ints.
>
> There are several lists:
> a = [1, 2, 3, 4, 5]
> b = [5, 4, 3, 2, 1]
> c = [0, 0, 0, 0, 0]
>
> I want to pass each value from these lists to that function.
> What is the most pythonic way?
>

function(*a)

* expands a list into positional arguments and ** expands a dictionary
into keyword arguments.



More information about the Python-list mailing list