Answers for "how to delete from list python"

3

del list python

>>> a=[1,2,3]
>>> a.remove(2)
>>> a
[1, 3]
>>> a=[1,2,3]
>>> del a[1]
>>> a
[1, 3]
>>> a= [1,2,3]
>>> a.pop(1)
2
>>> a
[1, 3]
>>>
Posted by: Guest on May-19-2020
1

Python Remove List Items

thislist = ["apple", "banana", "cherry"]
thislist.remove("banana")
print(thislist)
Posted by: Guest on February-28-2021

Code answers related to "how to delete from list python"

Python Answers by Framework

Browse Popular Code Answers by Language