Out[29]: 7
In [30]: lst1[-3]
2)list.index()
返回查找到该元素的第一个索引
如果该元素不存在,则抛出ValueError
start参数指定从哪个索引开始查找...;stop参数指定从哪个索引结束,并且不包含该索引
start和stop可以为负数,但是总是从左往右查找
In [51]: help(lst2.index)
Help on built-in...In [29]: lst1
Out[29]: ['x', 1, 3, 55, 2, 3, 4, 5, 6, 9, ['a', 'b'], 'xj', 'j']
3)list.extend()
接受一个可迭代对象...02c3871eac43> in ()
----> 1 lst1.pop(15)
IndexError: pop index out of range
小结:
pop()不传递Index参数时...,时间复杂度O(1)
pop()传递index参数时,时间复杂度O(n)
pop()根据索引删除元素,返回删除的元素
remove根据值删除元素,返回None
3)list.clear