Python plistlib Module
Example
Create a small plist as bytes and read it back:
import plistlib
data = {"name": "Emil", "age": 30}
b = plistlib.dumps(data, fmt=plistlib.FMT_XML)
print(plistlib.loads(b)["name"])
Try it Yourself »
Definition and Usage
The plistlib module reads and writes Apple Property List (plist) files.
Use it to serialize simple dictionaries, lists, and basic values in XML or binary plist formats.
Members
Member | Description |
---|---|
dump() | Write a Python value to a file-like object as a plist. |
dumps() | Return a plist as bytes from a Python value. |
FMT_BINARY | Constant selecting the binary plist format. |
FMT_XML | Constant selecting the XML plist format. |
load() | Read a plist from a file-like object and return a Python value. |
loads() | Read a plist from bytes and return a Python value. |
UID | Helper class representing UID values used by some Apple tools. |