Use the maxlen parameter while creating a deque to limit the size of the deque: from collections import deque d = deque(maxlen=3) # only holds 3 items ...
確定! 回上一頁