In [15]: def f(*args):
...: for i in args:
...: print(i)
...:
In [16]: f(1,2,3)
1
2
3
In [17]: a = ['ha']*3
In [18]: a
Out[18]: ['ha', 'ha', 'ha']
In [19]: f(a)
['ha', 'ha', 'ha']
In [20]: f(*a)
ha
ha
ha
python: *解包
最新推荐文章于 2024-05-06 00:59:05 发布