1、多返回值函数
def test01(x,y,z):
return x,y,z
x,y,z=test01(1,2,3)
2、位置参数,关键字参数,缺省参数
3、不定长位置参数
用元组储存 建议起名为*args
def test02(*location):
print(location[0])
test02(8,7,6,3,2)
4、不定长关键字参数
用字典储存 建议起名为**kwargs
def test03(**keys):
print(keys)
test03(name = "王哥",age = 10,addr = "北京 ")
5、函数作为参数定义函数、lambda定义匿名函数
(lambda 传入参数:函数体)(只能写一行)
def test04(test05):
num = test05(1,2)
return num
num = test04(lambda x,y:x+y)
print(num)