摘要: 统计元素数量,并返回字典,键为元素,值为个数 from collections import Counter lst = ['a','b','c','d','a','b','a','c','c','c'] dic = Counter(lst) print(dic) # Counter({'c': 4 阅读全文
posted @ 2024-05-04 12:32 wstong 阅读(13) 评论(0) 推荐(0) 编辑