2011年5月30日

python函数参数带星号*

摘要: def function_with_one_star(*t): print(t, type(t)) def function_with_two_stars(**d) print(d, type(d))上面定义了两个函数,分别用了带一个星号和两个星号的参数,它们是什么意思,运行下面的代码:function_with_one_star(1, 2, 3)function_with_two_stars(a = 1, b = 2, c = 3)结果如下(1, 2, 3) <class 'tuple'>{'a': 1, 'c': 3, ' 阅读全文

posted @ 2011-05-30 23:08 iAlex 阅读(16616) 评论(3) 推荐(1) 编辑

导航