From b3e0eead6184ecc686d868e261d621ac96d2493f Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Wed, 4 Dec 2024 15:12:17 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20=E4=BC=98=E5=8C=96=20JSON=20?= =?UTF-8?q?=E5=86=99=E5=85=A5=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整 JSON 写入时的缩进为 2 个空格,以保持一致性 - 添加 `sort_keys=False` 参数以避免键排序,保持原有顺序 --- app/run.py | 2 +- quark_auto_save.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/run.py b/app/run.py index 4ea2351..caa5e18 100644 --- a/app/run.py +++ b/app/run.py @@ -82,7 +82,7 @@ def read_json(): # 将数据写入 JSON 文件 def write_json(data): with open(CONFIG_PATH, "w", encoding="utf-8") as f: - json.dump(data, f, indent=4, ensure_ascii=False, sort_keys=False) + json.dump(data, f, ensure_ascii=False, sort_keys=False, indent=2) def is_login(): diff --git a/quark_auto_save.py b/quark_auto_save.py index d2d9f13..e63b6e8 100644 --- a/quark_auto_save.py +++ b/quark_auto_save.py @@ -964,7 +964,7 @@ def main(): if cookie_form_file: # 更新配置 with open(config_path, "w", encoding="utf-8") as file: - json.dump(CONFIG_DATA, file, ensure_ascii=False, indent=2) + json.dump(CONFIG_DATA, file, ensure_ascii=False, sort_keys=False, indent=2) print(f"===============程序结束===============") duration = datetime.now() - start_time