增加自动更新data.json的脚本
This commit is contained in:
17
comp_json.py
Normal file
17
comp_json.py
Normal 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")
|
||||
Reference in New Issue
Block a user