Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要制作一个有界队列的字典。以下是我到目前为止所拥有的。
from collections import defaultdict from collections import deque d = defaultdict(deque) ... q = d[name]
制作有界队列:q = deque(maxlen = 10)可行,但我不确定当队列在字典中时如何执行此操作。谁能帮我制作有界队列的地图?
q = deque(maxlen = 10)
你的意思是
from functools import partial d = defaultdict(partial(deque, maxlen=10))
?