您的位置:首页 > 编程语言 > Python开发

python 元组和字典中元素作为函数调用参数传递

2014-05-02 15:52 766 查看
模式1.

def test1(*args):

test3(*args)

def test2(**kargs):

test3(**kargs)

def test3(a, b):

print(a,b)

test1(1,2)
test2(a=1,b=2)


模式2.

def test4(a= ()):

test6(*a)

def test5(b = {}):

test6(**b)

def test6(a, b):

print(a,b)

test4((1, 2))
test5({'a':1,'b':2})


关于构建Python不定参数函数请移驾至:/article/6091639.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐