time

collections

1. deque()

from collections import deque

Counter

from collections import Counter

1. 作用

2. 初始化

from collections import Counter

# 实例化元素为空的 Counter 对象
a = Counter()

# 传入字符串
b = Counter('chenkc')

# 传入字典
c = Counter({'a':1, 'b':2, 'c':3})

# 传入关键词参数
d = Counter(a = 1, b = 2, c = 3)

3. Counter方法