python 队列简单操作

import collections
n=5
buffer=collections.deque(maxlen=n)

buffer.append('5')#尾端追加
buffer.popleft()#左端删除
buffer.count('5')#统计

print(len(buffer))#长度
if '5' in buffer:#是否存在某个值
    print('存在')

队列有关操作

原文地址:https://www.cnblogs.com/yanghao2008/p/12112194.html