W3docs

How to remove an element from a list by index

To remove an element from a list by index in Python, you can use the pop() method.

To remove an element from a list by index in Python, you can use the pop() method. The pop() method removes an element at a specific index and returns the element that was removed.

Here's an example:

Remove an element from a list by index using pop method in Python

python— editable, runs on the server
Info

Watch a video course: Python - The Practical Guide

You can also use the del statement to remove an element from a list by index.

Here's an example:

Remove an element from a list by index using a del statement in Python

python— editable, runs on the server

Note that the del statement does not return the removed element, it simply removes it from the list.