Update process_merge.py
This commit is contained in:
parent
d25a304c4d
commit
4ff7910368
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# 设置目录路径,这里假设你的JSON文件都在当前目录下的json_files文件夹中
|
# 设置目录路径,这里假设你的JSON文件都在当前目录下的directory_path文件夹中
|
||||||
directory_path = './'
|
directory_path = './'
|
||||||
|
|
||||||
# 初始化一个空列表,用于存储所有JSON文件的数据
|
# 初始化一个空列表,用于存储所有JSON文件的数据
|
||||||
@ -26,9 +26,9 @@ for filename in os.listdir(directory_path):
|
|||||||
else:
|
else:
|
||||||
combined_list.append(data)
|
combined_list.append(data)
|
||||||
|
|
||||||
# 打印合并后的列表
|
# 打印合并后的列表 very large and slow
|
||||||
# print(combined_list)
|
# print(combined_list)
|
||||||
|
|
||||||
# 如果需要,可以将合并后的列表保存到一个新的JSON文件中
|
# 如果需要,可以将合并后的列表保存到一个新的JSON文件中
|
||||||
with open('combined_data.json', 'w', encoding='utf-8') as combined_json_file:
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user