Python Wiki
Advertisement

This is a core module in Python

General[]

Pickle is a core module used for storing even more complicated data to files.
This means it can be used not only for Strings, but only for non-primitive data-types like dictionaries, tuples and others.

To start use:

import pickle

Functions[]

dump(object, file)[]

This writes the passed object to the passed file. Basis syntax for this:

f = open('test.txt','w')
x = {'core':'module'}
pickle.dump(x, f)
f.close()

dumps(object)[]

Returns a string format of the passed object

load(file)[]

Loads an object from file.
Syntax from example above:

x = pickle.load(f)

loads(string)[]

Loads an object from string

Advertisement