# if you want to remove all 2's from the list x = [1,2,3,2,2,2,3,4] new_x = list(filter(lambda a: a != 2, x)) # the output: # [1, 3, 3, 4]