Difference between del and .remove?


#1


Can somebody please explain to me what the difference between del and .remove? In which case do I use one or the other?


Replace this line with your code.


#2

del removes based on index, remove() based on item:

x = ["a", "b", "c", "d", "e"]
del x[0]
x.remove("e")

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.