[Solved] Getting a count of list elements [closed]


Use the Counter.

from collections import Counter

A = [[1,2], [2,1], [3,1], [1,2]]
print Counter(tuple(i) for i in A)

>>> 
Counter({(1, 2): 2, (3, 1): 1, (2, 1): 1})

1

solved Getting a count of list elements [closed]