Pickle - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Pickle (.pkl) File Format

Pickle file format

 

Description

Examples

Description

• 

Pickle is a binary file format for storing arbitrary Python data.

• 

The general-purpose commands Import and Export support this format.

• 

Export accepts any input which is accepted by convert/python.

• 

Import produces an expression of type python.

• 

Note that this file format is not secure. It is possible to construct malicious pickle data which will execute arbitrary code on import. It should therefore only be used with trusted data.

Examples

Encode a matrix as a pickle expression.

pickledmatrixconvert1,2|3,4,ByteArray,format=Pickle

Import a pickled expression from a file.

Importexample/address.pkl,base=datadir

tablefounded=1988&comma;companyName=Maplesoft&comma;phoneNumbers=<Python object: {'type': 'local', 'number': '+1 (519) 747-2373'}>&comma;<Python object: {'type': 'tollfree', 'number': '+1 (800) 267-6583'}>&comma;<Python object: {'type': 'fax', 'number': '+1 (519) 747-5284'}>&comma;address=tablecountry=Canada&comma;postalCode=N2V 1K8&comma;province=ON&comma;city=Waterloo&comma;streetAddress=615 Kumpf Drive

(1)

Import the same data, but as a python  expression.

Importexample/address.pkl&comma;base=datadir&comma;output=python

<Python object: {'founded': 1988, 'address': {'country': 'Canada', 'postalCode': 'N2V 1K8', 'province': 'ON', 'city': 'Waterloo', 'streetAddress': '615 Kumpf Drive'}, 'phoneNumbers': [{'type': 'local', 'number': '+1 (519) 747-2373'}, {'type': 'tollfree', 'number': '+1 (800) 267-6583'}, {'type': 'fax', 'number': '+1 (519) 747-5284'}], 'companyName': 'Maplesoft'}>

(2)

See Also

Formats

Formats,NPY

Formats,NPZ