How to remove all occurrences of specific list from a list of lists with Python

1 Answer

0 votes
lst_lst = [[1], [1, 2], [3, 4], [1, 2], [8, 7, 1, 2]] 
  
lst = [1, 2] 

lst_lst = [e for e in lst_lst if e != lst] 
  
print(lst_lst) 



'''
run:

[[1], [3, 4], [8, 7, 1, 2]]

'''

 



answered Dec 26, 2019 by avibootz
...