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});
 

你可能感兴趣的:(python,神奇的星号,megicalAsterisk)