MCPcopy Create free account
hub / github.com/ActiveState/code / save

Function save

recipes/Python/189972_Zip_and_Pickle/recipe-189972.py:14–19  ·  view source on GitHub ↗

Saves a compressed object to disk

(object, filename, bin = 1)

Source from the content-addressed store, hash-verified

12
13
14def save(object, filename, bin = 1):
15 """Saves a compressed object to disk
16 """
17 file = gzip.GzipFile(filename, 'wb')
18 file.write(pickle.dumps(object, bin))
19 file.close()
20
21
22def load(filename):

Callers 1

recipe-189972.pyFile · 0.70

Calls 3

writeMethod · 0.45
dumpsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected