此章描述的模块支持以持久形式在磁盘存储 Python 数据。
pickle
and
marshal
modules can turn many Python data types into a stream of bytes and then recreate the objects from the bytes. The various DBM-related modules support a family of hash-based file formats that store a mapping of strings to other strings. The
bsddb
module also provides such disk-based string-to-string mappings based on hashing, and also supports B-Tree and record-based formats.
此章描述的模块列表:
pickle
— Python 对象序列化
cPickle
— 更快
pickle
copy_reg
— 注册
pickle
支持函数
shelve
— Python 对象持久性
marshal
— 内部 Python 对象序列化
anydbm
— 对 DBM 样式数据库的一般访问
whichdb
— 猜测哪个 DBM 模块创建数据库
dbm
— 简单数据库接口
gdbm
— dbm 的 GNU 重新解释
dbhash
— DBM 样式 BSD 数据库的库接口
bsddb
— 接口到 Berkeley DB 库
dumbdbm
— 便携式 DBM 实施
sqlite3
— SQLite 数据库的 DB-API 2.0 接口