Structured Data Modules

plistlib

Read and write Apple property-list data in XML or binary formats. dumps()/loads() operate on serialized bytes, while dump()/load() use binary streams. Supported values include dictionaries with string keys, lists, bytes and dates; not arbitrary Python objects. Use trusted bounded input.

Formal Syntax & Structure

python syntaxpython
import plistlib

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import plistlibrecord = {"name": "Ada", "enabled": True}encoded = plistlib.dumps(record, fmt=plistlib.FMT_BINARY)print(encoded[:8])print(plistlib.loads(encoded)["name"])
Python Reference