xxxxxxxxxx
list_ = ["lots", "of", "items", "in", "a", "list"]
# Remove an item by index and get its value: pop()
>>> list_.pop(0)
'lots'
>>> list_
["of", "items", "in", "a", "list"]
# Remove an item by value: remove()
>>> list_.remove("in")
>>> list_
["of", "items", "a", "list"]
# Remove items by index or slice: del
>>> del list_[1]
>>> list_
['of', 'a', 'list']
# Remove all items: clear()
>>> list_.clear()
>>> list_
[]
xxxxxxxxxx
# removes item with given name in list
list = [15, 79, 709, "Back to your IDE"]
list.remove("Back to your IDE")
# removes last item in list
list.pop()
# pop() also works with an index...
list.pop(0)
# ...and returns also the "popped" item
item = list.pop()
xxxxxxxxxx
l = list[1, 2, 3, 4]
l.pop(0) #remove item by index
l.remove(3)#remove item by value
#also buth of the methods returns the item
xxxxxxxxxx
# removes item with given name in list
list = [15, 79, 709, "Back to your IDE"]
list.remove("Back to your IDE")
# removes last item in list
list.pop()
# pop() also works with an index..
list.pop(0)
# ...and returns also the "popped" item
item = list.pop()
xxxxxxxxxx
myList = ['Item', 'Item', 'Delete Me!', 'Item']
del myList[2] # myList now equals ['Item', 'Item', 'Item']