from collections import deque
li = deque([1,2,3,4,5])
print(li)
li.append(6)
print(li)
li.appendleft(0)
print(li)
li.pop()
print(li)
li.popleft()
print(li)
优化了首位两端操作的deque
最新推荐文章于 2024-08-14 23:30:40 发布
from collections import deque
li = deque([1,2,3,4,5])
print(li)
li.append(6)
print(li)
li.appendleft(0)
print(li)
li.pop()
print(li)
li.popleft()
print(li)