collections.deque -- 队列的使用

deque(maxlen=N)建立一个固定长度的队列。当有新纪录加入而队列已满时会自动移除最老的那条记录。python from collections import deque q = deque(maxlen=3) q Out[9]: deque([]) q.append(1) q.append(2) q.append(3) q Out[13]: deque([1, 2, 3]) q.appe
相关文章
相关标签/搜索