deque
基本用法
from collections import deque a = deque() for i in range(5): a.append(i) print(a) a.appendleft(5) print(a) a.pop() print(a) a.popleft() print(a) print(len(a))
from collections import deque a = deque() for i in range(5): a.append(i) print(a) a.appendleft(5) print(a) a.pop() print(a) a.popleft() print(a) print(len(a))