how to delete all items list python code example
Example 1: how to clear all elements in a list python
# this clear whole elements from list
thislist = ["apple", "banana", "cherry"]
thislist.clear()
Example 2: how to delete list python
# delete by index
a = ['a', 'b', 'c', 'd']
a.pop(0)
print(a)
['b', 'c', 'd']