Python List/Array Methods
- Previous Page Python String Methods
- Next Page Python Dictionary Methods
Python has a set of built-in methods that can be used on lists/arrays.
Method | Description |
---|---|
append() | Add an element at the end of the list |
clear() | 删除列表中的所有元素 |
Delete all elements from the list | copy() |
Return a copy of the list | count() |
Return the number of elements with specified values | extend() |
Add list elements (or any iterable elements) to the end of the current list | index() |
Return the index of the first element with specified value | insert() |
Add elements at specified positions | pop() |
Delete elements at specified positions | remove() |
Delete items with specified values | reverse() |
Reverse the order of the list | sort() |
Sort the listNote:
Learn more about lists in Python does not have built-in support for arrays, but can use Python lists. Python List Tutorial
Learn more about lists in Python Array Tutorial Learn more about arrays in
- Previous Page Python String Methods
- Next Page Python Dictionary Methods