python - function
- python 函数的参数可以具有默认值
We can provide a default value to an argument by using the assignment operator (=).
- python函数的参数都可以有默认值,但是有默认值的参数必须在右侧,否则报错。
Any number of arguments in a function can have a default value. But once we have a default argument, all the arguments to its right must also have default values.
- python函数,支持参数可以是多个或者是未知数个参数。
Sometimes, we do not know in advance the number of arguments that will be passed into a function. Python allows us to handle this kind of situation through function calls with an arbitrary number of arguments.
In the function definition, we use an asterisk (*) before the parameter name to denote this kind of argument.
keyword argument: