python3_统计重复项
mylist = [1,2,2,2,2,3,3,3,4,4,4,4] myset = set(mylist) #myset是另外一个列表,里面的内容是mylist里面的无重复 项 print(myset) for item in myset: print(item,mylist.count(item)) print("the %d has found %d" %(item,mylist.count(item))) ''' {1, 2, 3, 4} 1 1 the 1 has found 1 2 4 the 2 has found 4 3 3 the 3 has found 3 4 4 the 4 has found 4 '''