+ 4
Remove only removes the first occurrence, so if there are more of that element in there, you'll only drop the first one.
If you know the index, you can write:
del your_list[that_index]
If you want to pull out some item, so remove it and directly use it, you can write:
x = your_list.pop(index)
+ 4
Python has a remove command
list.remove(element).
Is this what you need?
+ 1
myint = 4 # <- the number you want to be removed from list
mylist = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 4]
for x in range(mylist[:].count(myint)):
mylist.remove(myint)
print(mylist)



