创建元祖
temp = 1,2,3,4,5,6,7,8temp = (1,2,3,4,5,6,7,8)# 上面 2 种方式都可以创建
访问元祖
temp = 1,2,3,4,5,6,7,8temp[:3]temp[3:]temp, tow, three = (1,2,3,4,5,6,7,8)print(temp, tow, three) # 这样就能获取访问到前3个数
更新插入元祖
原理,把现有的元祖进行切片, 然后构成新的元祖<br />注意插入的数据.如果只有1个的话. **后面需要要逗号**
temp = 1,2,3,4,5,6,7,8temp = temp[:2] + (20,) + temp[2:]# 1,2,20,3,4,5,6,7,8
删除元祖
temp = 1,2,3,4,5,6,7,8del temp
重复元祖
temp = 8 * (8,)# 打印 (8,8,8,8,8,8,8,8)
