Python函数简单练习

#!/usr/bin/env/python 3.3.1
def f(name="name",age=0):
	print (name)
	print (age)
	
f(age=30,name="wustrive")
f(*[2,3])
f(**{"age":43,"name":"wustrive"})

def f2(x,*args,**kwargs):
	print (x)
	print (args)
	print (kwargs)
	
f2(1)
f2(1,2,3,4)
f2(1,2,3,4,e=2)

输出结果:
#wustrive
#30
#2
#3
#wuss
#43
#1
#()
#{}
#1
#(2, 3, 4)
#{}
#1
#(2, 3, 4)
#{'e': 2}

你可能感兴趣的:(python,python,开发语言)