There is a list, find the repeated elements in the list, such as list1 = [1,2,4,3,6,4]
method one,
list1 = [1,2,4,3,6,4] myset = set(list1) for each in myset: print each,list1.count(each)
Method 2, Counter()
list1 = [1,2,4,3,6,4] from collections import Counter c = Counter(list1)