Update process_merge.py

This commit is contained in:
HongCheng 2024-03-21 16:07:18 +09:00 committed by GitHub
parent d25a304c4d
commit 4ff7910368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
import os
import json
# 设置目录路径这里假设你的JSON文件都在当前目录下的json_files文件夹中
# 设置目录路径这里假设你的JSON文件都在当前目录下的directory_path文件夹中
directory_path = './'
# 初始化一个空列表用于存储所有JSON文件的数据
@ -26,9 +26,9 @@ for filename in os.listdir(directory_path):
else:
combined_list.append(data)
# 打印合并后的列表
# 打印合并后的列表 very large and slow
# print(combined_list)
# 如果需要可以将合并后的列表保存到一个新的JSON文件中
with open('combined_data.json', 'w', encoding='utf-8') as combined_json_file:
json.dump(combined_list, combined_json_file, ensure_ascii=False, indent=4)
json.dump(combined_list, combined_json_file, ensure_ascii=False, indent=4)