delete list index python code example
Example 1: remove value from python list by value
>>> a = ['a', 'b', 'c', 'd']
>>> a.remove('b')
>>> print a
['a', 'c', 'd']
Example 2: 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)