关于python的函数调用传递的参数前面的*
调用(caller)
func(*sequence) Pass all objects in sequence as individual positional arguments
seq = [1,2,3]
func(*seq) -> func(1, 2, 3)
func(**dict) Pass all key/value pairs in dict as individual keyword arguments
dict = {'a' = 1, 'b' = 2}
func(*dict) -> func(a = 1, b = 2)
函数定义的
def func(*name) Matches and collects remaining positional arguments in a tuple
func(1, 2, 3) -> name = [1, 2, 3]
def func(**name) Matches and collects remaining keyword arguments in a dictionary
func(a = 1, b= 2) -> dict = {'a' = 1, 'b' = 2}
可参考<learning python> Chapter 18. Arguments

浙公网安备 33010602011771号