>>> a = ["aa","aa","bb","cc","bb","aa","dd","cc","aa","aa","aa"] >>> a ['aa', 'aa', 'bb', 'cc', 'bb', 'aa', 'dd', 'cc', 'aa', 'aa', 'aa'] >>> b = sorted(list(set(a))) >>> b ['aa', 'bb', 'cc', 'dd'] >>> for i in b: a.count(i) 6 2 2 1 >>> for i in range(a.count("aa")-1): a.remove("aa") >>> for i in b: a.count(i) 1 2 2 1 >>> a ['bb', 'cc', 'bb', 'dd', 'cc', 'aa']