首页 > 编程语言 > 详细

Python自定义函数的参数

时间:2018-06-05 18:27:56      阅读:191      评论:0      收藏:0      [点我收藏+]

在Python中自定义的函数可以有三类不同的参数

  • formal parameters
  • positional arguments
  • Keyword Arguments

 

When a final formal parameter of the form **name is present, it receives a dictionary (see Mapping Types — dict) containing all keyword arguments except for those corresponding to a formal parameter. This may be combined with a formal parameter of the form *name (described in the next subsection) which receives a tuple containing the positional arguments beyond the formal parameter list. (*name must occur before **name.) For example, if we define a function like this:

Python自定义函数的参数

原文:https://www.cnblogs.com/yanzibuaa/p/9141051.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!