标签:元组 bar color rgs style code war int span
l1 = [1,2,3,4] t1 = (1,2,3,4) d1 = {‘name‘:‘tank‘,‘age‘:73} print(*l1) 打散列表 1 2 3 4 print(*t1) 打散元组 1 2 3 4 print(*d1) 打散字典 name age 只能得到key
print(**d1) #报错
def bar(*args, **kwargs): # 这里只打散值 print(args) args #元组(1, 2, 3) print(kwargs) kwargs # 字典 {‘d‘: 10, ‘e‘: 20, ‘f‘: 30} bar(1, 2, 3, d=10, e=20, f=30)
1 2 3 4
1 2 3 4
name age
(1, 2, 3)
{‘d‘: 10, ‘e‘: 20, ‘f‘: 30}
标签:元组 bar color rgs style code war int span
原文地址:https://www.cnblogs.com/bigbox/p/12070899.html