rest – Preferred (or most common) file extension for a Python pickle

rest – Preferred (or most common) file extension for a Python pickle

Python 2

From the Python 2 documentation, while serializing (i.e. writing to a pickle file), use:

output = open(data.pkl, wb)

I would choose .pkl as the extension when using Python 2.

Python 3

The example in the Python 3 documentation now uses .pickle as the file extension for serialization:

with open(data.pickle, wb) as f:
    pickle.dump(...)

The MIME type preferred for sending pickles from martineaus comment below:

application/octet-stream

See What is the HTTP content-type to use for a blob of bytes?

rest – Preferred (or most common) file extension for a Python pickle

Leave a Reply

Your email address will not be published. Required fields are marked *