模式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
本文深入探讨了Python中如何使用不定参数。通过两个模式演示了如何传递任意数量的位置参数和关键字参数给函数。第一种模式展示了如何直接将参数传递给另一个函数,第二种模式则通过元组和字典间接传递参数。
2879

被折叠的 条评论
为什么被折叠?



