2005年07月26日 星期二 20:15
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050726/99d64a21/attachment.htm
2005年07月26日 星期二 21:48
pickle是Python对象持久化存储的一种工具。用途是把任何的对象(比如列表或字典) 转换成可供存储的字符串。 您的问题我不太明白,什么是存储文件?如果是要把二进制文件转换成字符串来保存, 可以用base64编码。还有 您的应用环境不明确,请说明一下。 cPickle是比Pickle更快速的一种方法,但是局限性稍大,可以查找手册了解 语法是 string_1=Pickle.dumps(object_1) #将对象object_1转换为字符串string_1 object_1=Pickle.loads(string_1) #将字符串string_1还原为对象object_1 -----Original Message----- From: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn]On Behalf Of BlueKey Sent: 2005年7月26日 20:16 To: python-chinese at lists.python.cn Subject: [python-chinese] 请问怎么用pickle生成存储文件啊?谢先 需要一个2000兆的免费邮箱吗? 网易免费邮箱是中国最多人使用的电子邮箱。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050726/7af26dab/attachment-0001.html
2005年07月26日 星期二 21:49
手册不是写了吗?
import pickle
f = file('yourfile.pickle', 'wb')
pickle.dump(obj, f)
f.close()
在 05-7-26,BlueKey<bluekey19 at 126.com> 写道:
>
>
>
>
>
>
>
>
>
> 需要一个2000兆的免费邮箱吗?
> 网易免费邮箱是中国最多人使用的电子邮箱。
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
>
>
--
I like python!
My Donews Blog: http://www.donews.net/limodou
New Google Maillist: http://groups-beta.google.com/group/python-cn
Zeuux © 2025
京ICP备05028076号