pickle序列化存储于加载 import pickle # 序列化词典 with open('vocab_cn.pk', 'wb') as fr: pickle.dump(vocab, fr) # 加载词表 fr = open('vocab_cn.pk', 'rb+') x = pickle.load(fr) print(x)