首页 > 其他 > 详细

动态参数

时间:2017-10-28 15:04:16      阅读:184      评论:0      收藏:0      [点我收藏+]
def func(*a):
print(a,type(a))
func(1,2,3,4,5,)
def func1(**a):
print(a,type(a))
func1(k=1,k2=2,k3=3,k4=4,k5=5,)
def func2(*a1,**a):
print(a1,type(a1))
print ( a , type ( a ) )
func2(1,2,3,4,5,k=1,k2=2,k3=3,k4=4,k5=5,)
def func3(q,*a1,**a):
print(q)
print(a1,type(a1))
print ( a , type ( a ) )
func3(1,2,3,4,5,k=1,k2=2,k3=3,k4=4,k5=5,)
list_1=[1,2,3,4]
dict_1={‘k1‘:123,‘k2‘:456}
def func4(*a):
print(a,type(a))
func4(list_1)
func4(*list_1)
func1(**dict_1)
func1()

动态参数

原文:http://www.cnblogs.com/chengguxian/p/7746938.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!