x = [1, 2, 3]
0 开始):e = x[1] # e == 2
+ 运算符连接两个列表。示例:x = [1, 2] + [3, 4] # x == [1, 2, 3, 4] x = ["a", "b"] x += ["c"] # x == ["a", "b", "c"]
['a', 'b', 'c', 'd'][1:3] # ['b', 'c'] ['a', 'b', 'c', 'd'][::2] # ['a', 'c'] ['a', 'b', 'c', 'd'][3:0:-1] # ['d', 'c', 'b']
成员
append
None list.append(item)
参数
| 参数 | 说明 | 
|---|---|
| item | 必需 要在末尾添加的内容。 | 
清除
None list.clear()
扩展
None list.extend(items)
参数
| 参数 | 说明 | 
|---|---|
| items | 必需 要在末尾添加的内容。 | 
索引
int list.index(x, start=None, end=None)
参数
| 参数 | 说明 | 
|---|---|
| x | 必需 要搜索的对象。 | 
| start | int; or None;
                                     默认 = 无要检查的列表部分的起始索引。 | 
| end | int; or None;
                                     默认 = 无要检查的列表部分的结束索引。 | 
insert
None list.insert(index, item)
参数
| 参数 | 说明 | 
|---|---|
| index | 必需 指定位置的索引。 | 
| item | 必需 商品。 | 
pop
unknown list.pop(i=-1)
index,则系统会移除并返回列表中的最后一项。
          
      参数
| 参数 | 说明 | 
|---|---|
| i | int; or None;
                                     默认值 = -1项的索引。 | 
移除
None list.remove(x)
参数
| 参数 | 说明 | 
|---|---|
| x | 必需 要移除的对象。 |