Toggle navigation
Log in
Sign Up
Log in
Sign Up
Appium
C
C#
C++
Docker
Go
Informatica
Java
JavaScript
Kafka
Numpy
Oracle
Pandas
PHP
Py Spark
Python
R
React Native
Scipy
SFTP
Tableau
Teradata
TGMC
UNIX
Introducing
Radical.sh
Forget Code launches a powerful code generator for building API's
Forget_Code.Models.CategoryViewModel
Add a new snippet
Basics
3
Conditional Statements
2
Dictionary
4
Input & Output
1
Lists
20
Sorting
1
Strings
1
Tuple
4
Choose Category
Remove an item from list in Python
Forget Code
Python
Remove an item from list
In python pop method can used to remove the item from the list. By default using pop method on the list removes the last item of the list and returns the item.
Pop method takes an optional argument which can be used to remove any element from the list and return the element.
cars = ["Mercedes Benz","Honda","Audi", "Volkswagen"] cars.pop(2) cars.pop() cars
Output
'Audi'
'Volkswagen'
['Mercedes Benz', 'Honda']
Note : Pop mutates the existing list
Tags for Remove an item from list in Python
DP_Lists
remove an element in list in python
removal of last element in python
pop in python
remove any element from list
list remove one element in python
Contribute to Forget Code, help others.
Add snippet