import os
import json
import codecs
from tqdm import tqdm
if __name__=="__main__":
test_file = "json标注"
test_file_list = os.listdir(test_file)
json_save_path="after_json"
for json_file in tqdm(test_file_list):
json_name=json_file.split(".")[0]
json_result = json.load(open(os.path.join(test_file,json_file), 'r', encoding='utf-8'))
new_json=codecs.open(os.path.join(json_save_path,str(json_name)+'.json'), mode='w', encoding='utf-8')
new_json.write(json.dumps(json_result, ensure_ascii=False, indent=3))
转换成结构化json
猜你喜欢
转载自blog.csdn.net/tumi678/article/details/118107610
今日推荐
周排行