只需使用
Counter来自
collections:
from collections import CounterA = [[x,y],[a,b],[c,f],[e,f],[a,b],[x,y]]new_A = map(tuple, A) #must convert to tuple because list is an unhashable typefinal_count = Counter(new_A)#final output:for i in set(A): print i, "=", final_count(tuple(i))



