增加自动更新data.json的脚本

This commit is contained in:
2026-01-28 15:13:46 +08:00
parent b209cb7b7b
commit cf762968fd
4 changed files with 29281 additions and 14622 deletions

17
comp_json.py Normal file
View File

@@ -0,0 +1,17 @@
import json
# 读取 A 和 B 文件
with open("data.json", "r", encoding="utf-8") as f:
a = json.load(f)
with open("holidays_2026.json", "r", encoding="utf-8") as f:
b = json.load(f)
# 假设 list 在 data.list 下(根据你之前的接口结构)
a["list"].extend(b["data"]["list"])
# 保存合并结果
with open("merged.json", "w", encoding="utf-8") as f:
json.dump(a, f, ensure_ascii=False, indent=2)
print("✅ 合并完成!结果已保存到 merged.json")