Spaces:
Paused
Paused
File size: 499 Bytes
3de0e37 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# -*- coding: utf-8 -*-
"""
# File name: utils.py
# Time : 2021/11/29 16:36
# Author: xyguoo@163.com
# Description:
"""
import os
import pickle
import tqdm
def merge_pickle_dir_to_dict(dir_name, target_path):
files = os.listdir(dir_name)
res_dir = {}
for f_name in tqdm.tqdm(files):
with open(os.path.join(dir_name, f_name), 'rb') as f:
res_dir[f_name[:-4]] = pickle.load(f)
with open(target_path, 'wb') as f:
pickle.dump(res_dir, f)
|