python备忘录

python备忘录

YYk Lv2

python 基本函数

collections

Counter 可计数容器

1
2
3
4
5
from collections import Counter

lst = ['a', 'b', 'a', 'c']
cnt = Counter(lst)
print(cnt)
  • Title: python备忘录
  • Author: YYk
  • Created at : 2025-06-10 20:06:36
  • Updated at : 2025-06-10 21:07:57
  • Link: https://yykwd.github.io/2025/06/10/Memory/python/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments