Python List Methods

Methods are functions bound to an object (in this case, a list). Call a method using a dot after the object (list), and pass arguments similarly to functions.

Below is a list of all list methods in Python, sorted alphabetically.

append(x)

Adds an element to the end of the list.

Read more

clear()

Removes all values from the list.

Read more

copy()

Returns a copy of the list.

Read more

count(x)

Returns the number of occurrences of a value in the list.

Read more

extend(iterable)

Extends the list with elements from the specified iterable object.

Read more

index(x[, start[, end]])

Returns the index of the first element with the value x.

Read more

insert(i, x)

Inserts the specified element at the specified index in the list.

Read more

pop([i])

Returns and removes the element at the specified position.

Read more

remove(x)

Removes the specified element from the list.

Read more

reverse()

Reverses the elements of the list.

Read more

sort(key=None, reverse=False)

Sorts the elements of the list.

Read more