I want to turn over the two-dimensional list as a factor for the Python zip function, what should I do? Like the JavaScript application method.
def myFunc(a1, a2, a3):
do_something(...)
myFunc.some_method([1,2,3])
Even if you put the factor in this way, I hope the result comes out as if you just did myFunc(1,2,3)
.
>>> def my_func(a1, a2, a3):
return a1+a2+a3
>>> my_func([1,2,3])
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
my_func([1,2,3])
TypeError: my_func() missing 2 required positional arguments: 'a2' and 'a3'
>>> my_func(*[1,2,3])
6
>>> a = [1,2,3]
>>> my_func(*a)
6
© 2024 OneMinuteCode. All rights reserved.