17 lines
483 B
Python
17 lines
483 B
Python
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") |