How to Remove Item or Clear List in Python?
remove() method: The remove() method removes the specified item. thislist = ["apple", "banana", "cherry"]thislist.remove("banana")print(thislist) pop() method: The pop() method removes the specified index. If you do not specify the index, the pop() method removes the last item. thislist = ["apple", "banana", "cherry"]thislist.pop(1)print(thislist) del keyword: The del keyword also removes the...
0 Comentários 0 Compartilhamentos 0 Anterior
Patrocinado