*li 代表除了第一个参数外的任意参数
*attrs 代表接受关键字参数
# *_*coding:utf-8 *_* def namelist(name, *li): print(type(li)) second = '.'.join(str(el) for el in list(li)) print(name + second) namelist('老王', 1, 2, 3, 4) def attrs(name, **attrs): print(name + 'size=' + attrs['size'] + ' ' + attrs['long']) attrs('老王', size='s', long='169')
<class 'tuple'> 老王1.2.3.4 老王size=s 169