File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8484
8585The interface is as follows:
8686
87- To pickle an object x onto a file f. open for writing:
87+ To pickle an object x onto a file f, open for writing:
8888
8989 p = pickle.Pickler(f)
9090 p.dump(x)
106106- None
107107- integers, long integers, floating point numbers
108108- strings
109- - tuples, lists and dictionaries containing picklable objects
109+ - tuples, lists and dictionaries containing only picklable objects
110110- class instances whose __dict__ or __setstate__() is picklable
111111
112112Attempts to pickle unpicklable objects will raise an exception
113113after having written an unspecified number of bytes to the file argument.
114114
115115It is possible to make multiple calls to Pickler.dump() or to
116116Unpickler.load(), as long as there is a one-to-one correspondence
117- betwee pickler and Unpickler objects and between dump and load calls
117+ between pickler and Unpickler objects and between dump and load calls
118118for any pair of corresponding Pickler and Unpicklers. WARNING: this
119119is intended for pickleing multiple objects without intervening modifications
120120to the objects or their parts. If you modify an object and then pickle
Original file line number Diff line number Diff line change 1111object):
1212
1313 import shelve
14- d = shelve.open(filename) # open, with (g)dbm filename
14+ d = shelve.open(filename) # open, with (g)dbm filename -- no suffix
1515
1616 d[key] = data # store data at key (overwrites old data if
1717 # using an existing key)
You can’t perform that action at this time.
0 commit comments