from collections import Counter
list_count= ["a", "a", "a", "b", "c", "c", "f", "g", "g", "g", "f"]
dict_count=Counter(list_count)
print(dict_count.most_common(1))
print(dict_count.most_common(1)[0][1])
利用collections里面的Counter函数简单统计一下字符的个数
于 2023-04-07 19:54:59 首次发布