元组与列表不同:不可改变
创建和访问一个元组
() & []
tuple1=(1,2,3,4,5)
tuple1[1]
(2) 元组
temp2=2
temp2
2 int
temp2=2,
temp2
(2) 元组
, 元组8*(8)
64
8*(8,)
(8,8,8,8,8,8,8,8,)
更新和删除一个元组
temp=(‘a’,’b’,’c’)
temp=temp[:2]+(‘d’,)+temp(2:)
temp
(‘a’,’b’,’d’,’c’)
del temp(很少用)
没有标签就会释放
元组相关的操作符
拼接+a+b+c a,c type same
重复*
in¬ in
<