Python - collections.Counter()计数器

版权声明:转载请注明出处 https://blog.csdn.net/qq_42292831/article/details/88930258
from collections import Counter

c=list(Counter(['11','22','11','33','11','44','55']))
print(type(c))
print(c)

c=list(Counter(['11','22','11','33','11','44','55']).items())
print(type(c))
print(c)

c2=Counter("abcdefdasfdsafaf")
print(c2)


可结合map(lambda())直接对数据整体进行处理从而得到统计值 :

https://blog.csdn.net/qq_42292831/article/details/88921541


猜你喜欢

转载自blog.csdn.net/qq_42292831/article/details/88930258