python pickle

 >>> import pickle
>>> m_list=['',2,'asa']
>>> m_list
['', 2, 'asa']
>>> m_file=open('my_file.pkl','wb')
>>> pickle.dump(m_list,m_file)
>>> pickle.close() Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
pickle.close()
AttributeError: 'module' object has no attribute 'close'
>>> my_file.close() Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
my_file.close()
NameError: name 'my_file' is not defined
>>> m_file.close()
>>> m_file=open('my_file.pkl','rb')
>>> m_list2=pickle.load(m_file)
>>> print (m_list2)
['', 2, 'asa']
>>>
上一篇:Cocos2d 中的Sprite大小调整问题


下一篇:Nginx 配置location root 转自https://blog.csdn.net/rofth/article/details/78581617