赞
踩
生成.pkl文件,读取.pkl文件的内容_weixin_39450145的博客-CSDN博客_pkl文件怎么生成1. 生成.pkl文件: (pickle.dump:把数据dump写入pkl文件)def save_dict(data, name): with open(name + '.pkl', 'wb') as f: pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)2.读取.pkl文件的内容:(pickle.load:从pkl文...https://blog.csdn.net/weixin_39450145/article/details/1049107381. 生成.pkl文件: (pickle.dump:把数据dump写入pkl文件)
- def save_dict(data, name):
- with open(name + '.pkl', 'wb') as f:
- pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
2. 读取.pkl文件的内容:(pickle.load:从pkl文件load加载数据)
- # read aus
- '''
- conds_filepath = os.path.join(self._root, self._opt.aus_file)
- self._conds = self._read_conds(conds_filepath)'''
-
- def _read_conds(self, file_path):
- with open(file_path, 'rb') as f:
- return pickle.load(f)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。