from collections import Counter
detail = Counter(some_list)
# 最多的前十个
detail.most_common(10)
# 不加参数,对整体进行排序
detail.most_common()
from collections import Counter
detail = Counter(some_list)
# 最多的前十个
detail.most_common(10)
# 不加参数,对整体进行排序
detail.most_common()
本文标题:python Counter排序
本文链接:https://www.haomeiwen.com/subject/lleufctx.html
网友评论