I am trying to load the MNIST dataset linked here in Python 3.2 using this program:
import pickle
import gzip
import numpy
with gzip.open(\'mnist.pkl.gz\',
Try:
l = list(pickle.load(f, encoding='bytes')) #if you are loading image data or
l = list(pickle.load(f, encoding='latin1')) #if you are loading text data
From the documentation of pickle.load
method:
Optional keyword arguments are fix_imports, encoding and errors, which are used to control compatibility support for pickle stream generated by Python 2.
If fix_imports is True, pickle will try to map the old Python 2 names to the new names used in Python 3.
The encoding and errors tell pickle how to decode 8-bit string instances pickled by Python 2; these default to 'ASCII' and 'strict', respectively. The encoding can be 'bytes' to read these 8-bit string instances as bytes objects.