python 读写 pickle文件
Jan. 15, 2020, 5:25 p.m.
read: 1419
以python3为例注意:python3 与 python2 默认生成的pickle文件不通用,你得加上参数, 即协议版本, 以下样例不加协议: # 写入文件 with open('1.pickle', 'wb') as f: pickle.dump(self.key_dict, f) # 读取文件 with open('1.pickle', 'rb') as f: key_dict = pickle.load(f)