其他分享
首页 > 其他分享> > pickle 存储列表为文件

pickle 存储列表为文件

作者:互联网

'''
save as list type
'''
import pickle


def saveList(paraList, path):
    output = open(path, 'wb')
    # Pickle dictionary using protocol 0.
    pickle.dump(paraList, output)
    output.close()


'''
load the pkl files
'''
def loadList(path):
    pkl_file = open(path, 'rb')
    segContent = pickle.load(pkl_file)
    pkl_file.close()
    return segContent

wanzi_antang 发布了12 篇原创文章 · 获赞 0 · 访问量 165 私信 关注

标签:load,存储,列表,file,output,path,pickle,pkl
来源: https://blog.csdn.net/wanzi_antang/article/details/104004065