我想像这样将列表的元素作为函数参数传递:
def foo(a, b, c):
# do something
list = [1, 2, 3]
foo(list)
我无法使用 foo(list[0], list[1], list[2])
,因为我不知道列表有多少元素以及函数需要多少参数。我想像这样将列表的元素作为函数参数传递:
def foo(a, b, c):
# do something
list = [1, 2, 3]
foo(list)
我无法使用 foo(list[0], list[1], list[2])
,因为我不知道列表有多少元素以及函数需要多少参数。