python的* 、**拆包(打散)功能
注:python3
*示例
>>> a = (1,2,3) >>> print(a) (1, 2, 3) >>> print(*a) 1 2 3 >>> >>> b = [1,2,3] >>> print(b) [1, 2, 3] >>> print(*b) 1 2 3 >>> >>> c = "123" >>> print(c) 123 >>> print(*c) 1 2 3 >>> >>> d = {"a":1, "b":2, "c":3} >>> print(*d)
**示例
>>> def func_dic(name, age): ... print(name, age) ... >>> func_dic(*dic) name age >>> func_dic(**dic) 张三 20