1.传递任意数量的关键字实参:符号为**
def build_porfile(first,last,**user_info):
profile={}
profile[‘first_name’]=first
profile[‘lase_name’]=last
for key,value in user_info.items():
profile[key]=value
return profile
user_info=build_porfile(‘albert’,‘einstein’,location=‘prinecton’,field=‘physics’)
print(user_info)
2.传递任意数量的实参:符号为*
#def sandwitch(*ingredents):
print(“The ingredient of the sandwitch including”)
for ingredent in ingredents:
print(ingredent)
sandwitch(‘cabbage’,‘prock’,‘beef’)
sandwitch(‘mutton’,‘fish’)