每天CookBook之Python-002

>>> from collections import deque
>>> q = deque(maxlen=3)
>>> q.append(1)
>>> q.append(2)
>>> q.append(3)
>>> print q
deque([1, 2, 3], maxlen=3)
>>> q.append(4)
>>> print q
deque([2, 3, 4], maxlen=3)
>>> q.append(5)
>>> print q
deque([3, 4, 5], maxlen=3)
posted @ 2016-07-03 21:44  4Thing  阅读(87)  评论(0)    收藏  举报