Thanos Mygdalias Thanos Mygdalias - 1 year ago 69
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.

Answer Source

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

>>> My_list.count([1, 2, 3])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download