Answers for "remove something from a list python"

1

Python Remove List Items

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

delete something from list python

import random


#Let's say that we have a list of names.
listnames = ['Miguel', 'James', 'Kolten']
#Now, I choose a random one to remove.
removing = random.choice(listnames)
#And to delete, I do this:
listnames.remove(remove)
Posted by: Guest on March-27-2020

Code answers related to "remove something from a list python"

Python Answers by Framework

Browse Popular Code Answers by Language