89DEVs

Python List

Python lists

methods of Lists in Python

How many List methods does Python have? In Python 11 list methods are available. The table below shows all List methods and the use case of each List method.
method use case
append() add a element a the end of the list
clear() removes all items from the list, this results in an empty list.
copy() creates a shallow copy of the list
count() counts the elements in the list and returns the count.
extend() appends an iterable to the end of the list
index() finds the index of the given element in the list and returns the index.
insert() inserts a given element at the given index.
pop() returns the element at the given index and removes it from the list.
remove() removes an element with the given value from the list.
reverse() reverses the list.
sort() sorts the elements of a list.

                
        

Summary


Click to jump to section