#元祖与列表基本上是一样的,只是元祖不可变,列表可以改变
tuple=(10,20,30,'abc','123',[1,2,3])
print(len(tuple))#6
print(10 in tuple)#True
print(tuple[2])#30
print(tuple[3])#abc
print(tuple[3:5])#('abc','123')
#tuple[-1]=100
print(tuple[::-1])
输出:
#元祖与列表基本上是一样的,只是元祖不可变,列表可以改变
tuple=(10,20,30,'abc','123',[1,2,3])
print(len(tuple))#6
print(10 in tuple)#True
print(tuple[2])#30
print(tuple[3])#abc
print(tuple[3:5])#('abc','123')
#tuple[-1]=100
print(tuple[::-1])
输出: