def fun1(a, b, c):
return a + b + c
print(fun1(3 ,2 ,1))
输出:
6
print(fun1(3 ,c = 1, b = 2))
输出:
6
def fun2(a, b, c = 100):
return a + b + c
print(fun2(1, 10))
print(fun2(1, 10, 0))输出:def fun3(*tup):
print type(tup)
print tup
fun3(1)
fun3(1, 2)
fun3(1, 2, 3)输出:def fun4(**dic):
print type(dic)
print dic
fun4(a=1,b=9)
fun4(m=2,n=1,c=11)输出:def fun5(a, b, c):
print(a, b, c)
args = (2, 1, 3)
fun5(*args)
dict = {'b':1,'a':2,'c':3}
fun5(**dict)输出:原文:http://blog.csdn.net/xufeng0991/article/details/39925057