Say I have a variable-length function like:
def foo(*args):
for x in args:
print(x)
Given a list like [1,2]
, how can I call foo
such that 1 and 2 are passed as two separate arguments to foo
, rather than a single list argument to it? I.e., I want to call foo as foo(1,2)
rather than `foo([1,2])