[ python-Bugs-1441072 ] No simple example for pickle
SourceForge.net
noreply at sourceforge.net
Wed Mar 1 17:49:40 CET 2006
Bugs item #1441072, was opened at 2006-03-01 16:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1441072&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Kent Johnson (kjohnson)
Assigned to: Nobody/Anonymous (nobody)
Summary: No simple example for pickle
Initial Comment:
The docs for pickle lack a simple example of typical
usage. The Example page has only an advanced example. I
suggest something like this be added to the Usage or
Examples page:
Here is a simple example that shows how to use pickle
to save and restore a dictionary:
>>> import pickle
>>> data = dict(a=1, b=2, c=[3,4,5], d='cheese')
>>> f=open('data.pickle', 'wb')
>>> pickle.dump(data, f)
>>> f.close()
>>>
>>> f=open('data.pickle', 'rb')
>>> data2=pickle.load(f)
>>> f.close()
>>> data2
{'a': 1, 'c': [3, 4, 5], 'b': 2, 'd': 'cheese'}
Kent
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1441072&group_id=5470
More information about the Python-bugs-list
mailing list