modified jsonfile save mode
This commit is contained in:
@@ -338,8 +338,11 @@ def main():
|
|||||||
return
|
return
|
||||||
|
|
||||||
associations = build_file_associations(word_content, twole_folder, zxxk_folder)
|
associations = build_file_associations(word_content, twole_folder, zxxk_folder)
|
||||||
|
|
||||||
output_file = base_dir / "file_associations.json"
|
# JSON 文件保存到 server 目录下的 jsons 文件夹,文件名与 Word 文档相同
|
||||||
|
server_jsons_dir = Path("server") / "jsons"
|
||||||
|
server_jsons_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
output_file = server_jsons_dir / f"{word_doc.stem}.json"
|
||||||
with open(output_file, 'w', encoding='utf-8') as f:
|
with open(output_file, 'w', encoding='utf-8') as f:
|
||||||
json.dump(associations, f, ensure_ascii=False, indent=2)
|
json.dump(associations, f, ensure_ascii=False, indent=2)
|
||||||
print(f"\n✓ 关联关系已保存到:{output_file}")
|
print(f"\n✓ 关联关系已保存到:{output_file}")
|
||||||
|
|||||||
Reference in New Issue
Block a user