码迷,mamicode.com
首页 > 编程语言 > 详细

python pickle

时间:2016-11-10 02:47:42      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:tee   pickle   module   call   span   ack   trace   close   mos   

 1 >>> import pickle
 2 >>> m_list=[1,2,asa]
 3 >>> m_list
 4 [1, 2, asa]
 5 >>> m_file=open(my_file.pkl,wb)
 6 >>> pickle.dump(m_list,m_file)
 7 >>> pickle.close()
 8 
 9 Traceback (most recent call last):
10   File "<pyshell#16>", line 1, in <module>
11     pickle.close()
12 AttributeError: module object has no attribute close
13 >>> my_file.close()
14 
15 Traceback (most recent call last):
16   File "<pyshell#17>", line 1, in <module>
17     my_file.close()
18 NameError: name my_file is not defined
19 >>> m_file.close()
20 >>> m_file=open(my_file.pkl,rb)
21 >>> m_list2=pickle.load(m_file)
22 >>> print (m_list2)
23 [1, 2, asa]
24 >>> 

 

python pickle

标签:tee   pickle   module   call   span   ack   trace   close   mos   

原文地址:http://www.cnblogs.com/13224ACMer/p/6049449.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!