【Python】Python - 整理一些常用的list methods。Python Lists methods
【Python】Python - 整理一些常用的list methods。Python Lists methods
| Method | Description |
|---|---|
| append() | 在list 尾端增加元素。 |
| clear() | 移除list中的所有元素。 |
| copy() | 回傳一個新的list, 資料copy自原始list。 |
| count() | 回傳參數內的元素在list中有幾個個數。 |
| extend() | 增加任何iterable 物件(包含list)到list的後面。 |
| index() | 回傳第一個在list內元素的索引值。 |
| insert() | 增加一個元素到指定位置。 |
| pop() | 移除特定位置的元素。 |
| remove() | 使用指定的值來移除list中的item。 |
| reverse() | 將list中的items反向排序。 |
| sort() | 排序list中的items。 |

留言
張貼留言