clear everything in a list in 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 clear a list in python
yourlist = [1,2,3,4,5,6,7,8]
del yourlist[:]