1.函数的定义
def 函数名(形参):
函数体
[returnXXX] #return 多个值,返回的是字典
2.函数的参数传递
位置实参

关键字实参

3.函数的参数定义
个数可变的位置参数
def fun(*args):
return 0
fun(10,20,30)
个数可变的关键字参数
def fun(**args):
return 0
fun(a=10,b=20,c=30)
def 函数名(形参):
函数体
[returnXXX] #return 多个值,返回的是字典
def fun(*args):
return 0
fun(10,20,30)
def fun(**args):
return 0
fun(a=10,b=20,c=30)
本文标题:函数
本文链接:https://www.haomeiwen.com/subject/cgikvktx.html
网友评论