Thanos Mygdalias Thanos Mygdalias - 2 months ago 13
Python Question

List occurrences in list of lists

We have a list containing lists like so:

My_list = [ [1,2,3],[4,5,6],[7,8,9],[1,2,3] ]

Is there an easy way to learn that the list item
appears twice in
? I am not interested in the individual numbers but i am interested in them as a list.


You may use list.count() in order to find the occurrence of item in the list as:

>>> My_list.count([1, 2, 3])