元组的实例

元组的传递
def func (a,*b):
print(type(b))
for n in b:
a+=n
print(a)
func(1,2,3,4,5) //通过调用func函数,会把2,3,4,5数值赋给元组b(可以理解为一元数组)

RESTART: C:/Users/Administrator/AppData/Local/Programs/Python/Python37/aa.py
<class ‘tuple’>
15 //输出结果

猜你喜欢

转载自blog.csdn.net/shaoyanshuyu/article/details/85995544