列表
>>> arr=[1,2,3,4]
>>> arr
[1, 2, 3, 4]
>>> print(arr)
[1, 2, 3, 4]
>>> arr[0]
1
>>> arr[0:]
[1, 2, 3, 4]
>>> arr[:3]
[1, 2, 3]
>>> arr[0]=6
>>> arr
[6, 2, 3, 4]
元组
>>> tuple=(1,'haha','77')
>>> tuple
(1, 'haha', '77')
>>> tuple[2]
'77'
>>> tuple[0:]
(1, 'haha', '77')
>>>#元组不能被修改
>>> tuple[2]=7
Traceback (most recent call last):
File "<pyshell#39>", line 1, in <module>
tuple[2]=7
TypeError: 'tuple' object does not support item assignment