tup = (1, 2.2, True, ‘hell’) # 可以放任意类型的数据
print(tup)
print(type(tup))
ret = tup[1]
print(ret)
tup1 = tup[0:4:1]
print(tup1)
name, age, height, weight = ('zs', 12, 123, 2134)
print('姓名是', name)
print('年龄是', age)
print('身高是', height)
print('体重是', weight)
biao = (('zs', 10), ('sd', 19), ('aa', 20))
for i in biao:
print(i)
for info in i:
print(info)
for name, age in biao:
print(name, age)
lst=[1,2,3]
tup=tuple(lst)
print(tup)
tup=(‘a’,‘b’,‘c’)
ret=list(tup)
print(ret)
——————————————————————————————————————————
tup = (‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’)
ret = tup.index(‘b’) # 根据内容反对应索引
ret = tup.index(‘d’, 2, len(tup)) #得出结果3
print(ret)