I have a function f(a,b,c) waiting for 3 int. I have a list t = list(1,2,3) that i want to input to f : f(t). But it doesn't work. What is the easiest way to do it.
EDIT : t = list('1','2','3')
Thank you
I have a function f(a,b,c) waiting for 3 int. I have a list t = list(1,2,3) that i want to input to f : f(t). But it doesn't work. What is the easiest way to do it.
EDIT : t = list('1','2','3')
Thank you
You need to unpack the values present in list t.
f(*t)
Example:
>>> def f(a,b,c):
print(a,b,c)
>>> t = [1,2,3]
>>> f(*t)
1 2 3
OR
>>> def f(a,b,c):
print(a,b,c)
>>> t = ['1','2','3']
>>> f(*map(int,t))
1 2 3