2025-09-10:仓库迁移

This commit is contained in:
2025-09-10 16:12:45 +08:00
parent e0e49b0ac9
commit 3130e336a1
146 changed files with 4066 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# 队列可以对最后N个元素进行保存
from collections import deque
# 从历史记录列表history得到length条最新历史记录
def latest_history(history, length):
window = deque(maxlen=length)
for record in history:
window.append(record)
# window引用双头队列组件deque,该组件有方法如下
# 从队尾加入
window.append(1)
# 从队尾弹出
window.pop()
# 从队头加入
window.appendleft(1)
# 从队头弹出
window.popleft()