Skip to main content

Python List Methods

List Satellite

List Methods

Lists come with a toolbox for mutating, searching, and rearranging data. Keep this reference handy.

Method table​

List methods overview
MethodDescription
Add item to end
extend(iterable)Concatenate iterables
insert(i, x)Insert at index (O(n))
remove(x)Remove first occurrence
pop([i])Remove and return element
clear()Remove all elements
index(x)Find first index of value
count(x)Count occurrences
sort()In-place sort
reverse()Reverse in place
copy()Shallow copy

Tips​

  • Use sorted(items) when you need a new list.
  • Combine extend with generator expressions for streaming data.
  • Prefer collections.deque for repeated pops from the left.

Next up in your learning path