双向队列from collections import deque

发音:/ dek /

 

from collections import deque

dq = deque(range(10), maxlen = 10)

print(dq)

dq.rotate(3)
print(dq)

dq.rotate(-4)
print(dq)
dq.appendleft(-1)
print(dq)
dq.extend([11,22,33])
print(dq)
dq.extendleft([10,20,30,40])
print(dq)

 

 

posted @ 2023-04-12 20:38  limalove  阅读(61)  评论(0)    收藏  举报