程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python learning 06-- functions and calls & parameters and variables

編輯:Python

1、 Functions and calls


TODO It's equivalent to a label , You can find it later TODO To find the incomplete function

2、 Let the function return multiple values

Receive separately

Encapsulated in a list

If the number of parameters returned by the function is uncertain , You cannot use the parameter that determines the number to receive

3、 Recursive function

The first thing you should do is write out the conditions for the end of the function

4、 Named keywords

Parameter name must be specified
Separated by named keywords , Keyword name must be specified during transfer . Otherwise, the report will be wrong .

Specify default parameters :

5、 Variable parameters

The number of parameters passed in during the call is uncertain

6、 Key parameters

The rest of the information is in key value Form transfer

Although encapsulated into a dictionary , But you can't pass a dictionary directly into it . When passing on the dictionary, you should also write **

When a named keyword is preceded by a variable parameter , Do not write ,*, Otherwise, the report will be wrong
Variable keywords must be followed by explicit keywords


To mix , The order of these parameters must not be disturbed , Can be less


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved