python fjarlægja þáttur af listanum
myList.remove(item) # Removes first instance of "item" from myList
myList.pop(i) # Removes and returns item at myList[i]
eyða frá lista python
list.remove(element)
fjarlægja atriði frá lista python
l = list[1, 2, 3, 4]
for i in range(len(list)):
l.pop(i) # OR "l.remove(i)"
python fjarlægja
# the list.remove(object) method takes one argument
# the object or element value you want to remove from the list
# it removes the first coccurence from the list
generic_list = [1, 2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 8, 8, 8]
generic_list.remove(1)
# The Generic list will now be:
# [2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 8, 8, 8]
hvernig á að eyða hlut frá lista python
myList = ['Item', 'Item', 'Delete Me!', 'Item']
del myList[2] # myList now equals ['Item', 'Item', 'Item']
hvernig á að eyða í python
#x will be deleted
print("x\b")