Python自定義函數的參數

在Python中自定義的函數能夠有三類不一樣的參數html

  • 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

相關文章
相關標籤/搜索