缺省参数和不定长参数

  1 def test(a,b=11,c=44):
  2     '''缺省参数'''
  3     print(a)
  4     print(b)
  5     print(c)
  6 test(a=13,c=14)
  7 #test(13)     #13默认给a
  8 
  9 
 10 
 11 
 12 
 13 def test2(a,b,*args):  #*argr 不定长参数,个数不定
 14     '''不定长参数'''
 15     print(a)
 16     print(b)
 17     print(args)
 18 
 19 test2(11,33,55,66,34)  #不能小于除*arge外形参的个数  这个例子不能小于2个
原文地址:https://www.cnblogs.com/Smalllv/p/8870749.html