忐忑纸鹤

文章
5
资源
1
加入时间
3年2月3天

python之deque

deque可以构造一个固定大小的队列,当超过队列之后,会把前面的数据自动移除掉。示例如下:q = deque(maxlen =3)q.append(1)q.append(2)q.append(3)q.append(4)print(q)输出如下: 还可以从左往右加from collections import dequeq = deque(maxlen =3)...