Python 通过pickle标准库加载和保存数据对象
2015-09-29 10:40
555 查看
import pickle with open('mydata.pickle','wb') as mysavedata: pickle.dump([1,2,'three'], mysavedata) with open('mydata.pickle','rb') as myrestoredata: a_list=pickle.load(myrestoredata) print(a_list)
import nester and print
import pickle import nester new_man=[ ] try: with open('mydata.pickle','rb') as man_file: new_man=pickle.load(man_file) except IOError as err: print('file error' + str(err)) except pickle.PickleError as perr: print('pickling error' + str(perr)) nester.print_lol(new_man)
相关文章推荐
- <PY>计算范数及效率
- [转载]Python爬虫入门三之Urllib库的基本使用
- numpy 文件存取
- python 多进程 内存 copy-on-write
- [python]-urllib和urllib2模块
- Python 3 TypeError: ‘str’ does not support the buffer interface
- Python – Check if key exists in dictionary
- Python Whois client example
- pythonWeb编程提交表单方法
- Python 3 : Convert string to bytes
- Python – How to delay few seconds
- python学习(三):matplotlib学习
- 2015/9/28 Python基础(19):类的定制和私有性
- python使用wxPython创建一个简单的文本编辑器。
- Python – How to loop a dictionary
- python encode和decode函数说明
- Python 网页爬虫
- 3.3.7 使用difflib.get_close_matches函数
- 关于Python中输出中文的一点疑问
- 用python做了一个 qq炫舞 机器人