使用列表列表中的列表作为函数调用中的参数

时间:2019-12-09 09:21:38

标签: python list

我正在尝试从列表列表中调用带有参数的函数,问题是即使列表列表中的每个列表都包含3个参数,它也将整个列表视为一个单独的参数。 如何获取将列表视为3个参数的函数

lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [2, 5, 8]]


def do_something(x, y, z):
    bla. bla. bla

do_something(lists[1])

,错误消息如下:

TypeError: do_something() missing 2 required positional arguments: 'y' and 'z'

0 个答案:

没有答案