plistlib — 生成和剖析 Apple .plist 文件

源代码: Lib/plistlib.py


This module provides an interface for reading and writing the “property list” files used by Apple, primarily on macOS and iOS. This module supports both binary and XML plist files.

特性列表 ( .plist ) file format is a simple serialization supporting basic object types, like dictionaries, lists, numbers and strings. Usually the top level object is a dictionary.

To write out and to parse a plist file, use the dump() and load() 函数。

To work with plist data in bytes or string objects, use dumps() and loads() .

Values can be strings, integers, floats, booleans, tuples, lists, dictionaries (but only with string keys), bytes , bytearray or datetime.datetime 对象。

3.4 版改变: New API, old API deprecated. Support for binary format plists added.

3.8 版改变: Support added for reading and writing UID tokens in binary plists as used by NSKeyedArchiver and NSKeyedUnarchiver.

3.9 版改变: 移除旧 API。