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


模式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不定参数函数请移驾至:http://www.cnblogs.com/doudongchun/p/3704108.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM