你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
没有找到相关结果
牟瑞 - 大数据 Hadoop 讲师 Hadoop入门课程地址:http://www.hellobi.com/course/39 有架构师,技术总监,CTO的职位请联系我! 2016-08-09 回答
赞同来自: Jazzka
#!/usr/bin/python # Filename: pickling.py import cPickle as p #import pickle as p shoplistfile = 'shoplist.data' # the name of the file where we will store the object shoplist = ['apple', 'mango', 'carrot'] # Write to the file f = file(shoplistfile, 'w') p.dump(shoplist, f) # dump the object to a file f.close() del shoplist # remove the shoplist # Read back from the storage f = file(shoplistfile) storedlist = p.load(f) print storedlist
要回复问题请先登录或注册
自称搞技术,其实写材料
推荐一份编程学习资源,包含了各类编程语言学习进阶路线图、视频教程、配套书籍文档、数百份面经,各大厂面试真题。编程语言包括:Java、前端、PHP、Python、Linux运维、软件测试、数据解构与算法、C语言、go语言等
微信扫码关注公众号,发送 "编程"获取资源
1 个回复
牟瑞 - 大数据 Hadoop 讲师 Hadoop入门课程地址:http://www.hellobi.com/course/39 有架构师,技术总监,CTO的职位请联系我! 2016-08-09 回答
赞同来自: Jazzka
两种方式:
1.重新解析这个字符串,还原回二维数组
2.通过序列化和反序列化的方式,将变量的值还原回去