码迷,mamicode.com
首页 > 其他好文 > 详细

默认形参 与 关键字实参的区别

时间:2019-05-07 01:33:19      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:pytho   for   form   def   区别   team   bottom   默认   调用   

# ### 默认形参 与 关键字实参的区别
# 函数的定义处 top middle bottom ... 默认形参
def five_class_xiongda_team(top="黄熊大",middle="黄文",bottom="罗婷",jungle="黄将用",support="王文"):
	print("top上单选手{top}".format(top=top))
	print("middle中单选手{middle}".format(middle=middle))
	print("bottom下路选手{bottom}".format(bottom=bottom))
	print("jungle打野选手{jungle}".format(jungle=jungle))
	print("support辅助选手 最后的希望vip{support}".format(support=support))
# 函数的调用处
# 关键字实参
# five_class_xiongda_team() top middle bottom ... 关键字实参
five_class_xiongda_team(top="黄于正",middle="王俊文",bottom="潘伟成",jungle="张国成")

  

默认形参 与 关键字实参的区别

标签:pytho   for   form   def   区别   team   bottom   默认   调用   

原文地址:https://www.cnblogs.com/huangjiangyong/p/10823148.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!