拆包

  1 def tese(a,b,c=33,*args,**kwarg):    #kwargs 存有键的值,字典 args存元组
  2     print(a)
  3     print(b)
  4     print(c)
  5     print(args)
  6     print(kwargs)
  7 
  8 
  9 A=(44,55,66)
 10 B={'name':'laoli','age':18}
 11 
 12 tese(11,12,13,*A,**B)     #拆包,A拆成元组显示在args中
 13                             # B,拆成字典在kwargs中
 14 
 15 tese(11,12,13,A,B)     #A,B都会显示在args中,kwargs没有
原文地址:https://www.cnblogs.com/Smalllv/p/8870876.html