Fandom

Python Wiki

Modules/Pickle

Redirected from Pickle

43pages on
this wiki
Add New Page
Talk0 Share

This is a core module in Python

General Edit

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 Edit

dump(object, file) Edit

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) Edit

Returns a string format of the passed object

load(file) Edit

Loads an object from file.
Syntax from example above:

x = pickle.load(f)

loads(string) Edit

Loads an object from string

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.