def count_list(list_one): '''统计列表中元素大于列表长度''' count_num=Counter(list_one) print(count_num) #({5: 8, 6: 3, 'a': 1, 2: 1, 35: 1, 8: 1, 58: 1}) for k,v in count_num.items(): if int(v) >= int(len(list_one)/2): print(k) if __name__ == '__main__': li=["a",2,5,35,6,5,5,6,6,5,5,5,5,8,5,58,] count_list(li)