day-4 variable parameter

. 1  DEF send_report (* args): # variable parameter, parameter set 
2      Print (args)
 . 3  # when * args parameter is not required, the number of parameters is not limited, a plurality of transmission parameters, in which a tuple 
. 4  send_report ( )
 . 5 send_report (. 1 )
 . 6 send_report (l, 2,3 )
 . 7  
. 8  DEF the send_mail (** kwargs): # keyword parameter is not required and returns a dictionary, when the reference parameter must name = 'xiaohei' that ways 
. 9      Print (kwargs)
 10  
. 11  the send_mail ()
 12 is the send_mail (. 1) # error 
13 is the send_mail (name = ' xiaohei ' , Age = '18 ' )
 14  
15  # keyword parameters can not talk back position parameter

 

Guess you like

Origin www.cnblogs.com/hujc/p/11759975.html
Recommended