`
rokily
  • 浏览: 3124 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

python - Magical Asterisk

阅读更多

def test1(t='t', *args):
    print ">>>> test1(*args)"
    print '----',t;
    for i in args:
        print i;

def test2(t='t', **args):
    print ">>>> test2(**args)"
    print '----',t;
    for i in args:
        print "key=", i, "value=", args[i];
    pass;
        
if __name__ == "__main__":
    test1(1,2,"string type",['list', 121345, 'abcdefg'],{"V1": "V1_value", "V2": 12345});
    test2(a1=1, a2=2, a3="string type", a4=['list', 121345, 'abcdefg'], a5={"V1": "V1_value", "V2": 12345});
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics