列表的操作
1.列表的修改
>>> name
['Frank', 'Lee', 2, ['Andy', 'Troy']]
>>> name[0] = "Frank Bian"
>>> name
['Frank Bian', 'Lee', 2, ['Andy', 'Troy']]
2.列表的插入
>>> name
['Frank Bian', 'Lee', 2, ['Andy', 'Troy']]
>>> name.insert(1,"Marlon") #插入到位置就是其下标的值
>>> name
['Frank Bian', 'Marlon', 'Lee', 2, ['Andy', 'Troy']]
3 列表的追加(append object to end)
>>> name
['Frank Bian', 'Marlon', 'Lee', 2, ['Andy', 'Troy']]
>>> help(name.append) >>> help(name.append) >>> name.append('Duff')
>>> name
['Frank Bian', 'Marlon', 'Lee', 2, ['Andy', 'Troy'], 'Duff']
4 列表元素删除(L.remove(value) -> None -- remove first occurrence of value.
Raises ValueError if the value is not present.)
>>> name.append('Duff')
>>> name
['Frank Bian', 'Marlon', 'Lee', 2, ['Andy', 'Troy'], 'Duff', 'Duff']
>>> name.remove('Duff')
>>> name
['Frank Bian', 'Marlon', 'Lee', 2, ['Andy', 'Troy'], 'Duff']
del 函数可以删除任何字典,字符串,列表
del ori_name[3:5]