remove all elements that go before variable python code example
Example 1: how to clear a list in python
yourlist = [1,2,3,4,5,6,7,8]
del yourlist[:]
Example 2: remove all of same value python list
x = [1, 2, 3, 2, 2, 2, 3, 4]
list(filter(lambda a: a != 2, x))