企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](pickle.xhtml "pickle —— Python 对象序列化") | - [上一页](macpath.xhtml "macpath --- Mac OS 9 路径操作函数") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - $('.inline-search').show(0); | # 数据持久化 本章中描述的模块支持在磁盘上以持久形式存储 Python 数据。 [`pickle`](pickle.xhtml#module-pickle "pickle: Convert Python objects to streams of bytes and back.") 和 [`marshal`](marshal.xhtml#module-marshal "marshal: Convert Python objects to streams of bytes and back (with different constraints).") 模块可以将许多 Python 数据类型转换为字节流,然后从字节中重新创建对象。 各种与 DBM 相关的模块支持一系列基于散列的文件格式,这些格式存储字符串到其他字符串的映射。 本章中描述的模块列表是: - [`pickle` —— Python 对象序列化](pickle.xhtml) - [与其他 Python 模块间的关系](pickle.xhtml#relationship-to-other-python-modules) - [与 `marshal` 间的关系](pickle.xhtml#comparison-with-marshal) - [与 `json` 模块的比较](pickle.xhtml#comparison-with-json) - [Data stream format](pickle.xhtml#data-stream-format) - [Module Interface](pickle.xhtml#module-interface) - [What can be pickled and unpickled?](pickle.xhtml#what-can-be-pickled-and-unpickled) - [Pickling Class Instances](pickle.xhtml#pickling-class-instances) - [Persistence of External Objects](pickle.xhtml#persistence-of-external-objects) - [Dispatch Tables](pickle.xhtml#dispatch-tables) - [Handling Stateful Objects](pickle.xhtml#handling-stateful-objects) - [Restricting Globals](pickle.xhtml#restricting-globals) - [性能](pickle.xhtml#performance) - [示例](pickle.xhtml#examples) - [`copyreg` --- Register `pickle` support functions](copyreg.xhtml) - [示例](copyreg.xhtml#example) - [`shelve` --- Python object persistence](shelve.xhtml) - [Restrictions](shelve.xhtml#restrictions) - [示例](shelve.xhtml#example) - [`marshal` --- Internal Python object serialization](marshal.xhtml) - [`dbm` --- Interfaces to Unix "databases"](dbm.xhtml) - [`dbm.gnu` --- GNU's reinterpretation of dbm](dbm.xhtml#module-dbm.gnu) - [`dbm.ndbm` --- Interface based on ndbm](dbm.xhtml#module-dbm.ndbm) - [`dbm.dumb` --- Portable DBM implementation](dbm.xhtml#module-dbm.dumb) - [`sqlite3` --- SQLite 数据库 DB-API 2.0 接口模块](sqlite3.xhtml) - [模块函数和常量](sqlite3.xhtml#module-functions-and-constants) - [连接对象(Connection)](sqlite3.xhtml#connection-objects) - [游标对象\*Cursor\*](sqlite3.xhtml#cursor-objects) - [行对象\*Row\*](sqlite3.xhtml#row-objects) - [异常](sqlite3.xhtml#exceptions) - [SQLite 与 Python 类型](sqlite3.xhtml#sqlite-and-python-types) - [概述](sqlite3.xhtml#introduction) - [Using adapters to store additional Python types in SQLite databases](sqlite3.xhtml#using-adapters-to-store-additional-python-types-in-sqlite-databases) - [Letting your object adapt itself](sqlite3.xhtml#letting-your-object-adapt-itself) - [Registering an adapter callable](sqlite3.xhtml#registering-an-adapter-callable) - [Converting SQLite values to custom Python types](sqlite3.xhtml#converting-sqlite-values-to-custom-python-types) - [Default adapters and converters](sqlite3.xhtml#default-adapters-and-converters) - [Controlling Transactions](sqlite3.xhtml#controlling-transactions) - [Using `sqlite3` efficiently](sqlite3.xhtml#using-sqlite3-efficiently) - [Using shortcut methods](sqlite3.xhtml#using-shortcut-methods) - [Accessing columns by name instead of by index](sqlite3.xhtml#accessing-columns-by-name-instead-of-by-index) - [使用连接作为上下文管理器](sqlite3.xhtml#using-the-connection-as-a-context-manager) - [常见问题](sqlite3.xhtml#common-issues) - [多线程](sqlite3.xhtml#multithreading) ### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](pickle.xhtml "pickle —— Python 对象序列化") | - [上一页](macpath.xhtml "macpath --- Mac OS 9 路径操作函数") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - $('.inline-search').show(0); | © [版权所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 软件基金会是一个非盈利组织。 [请捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [发现了问题](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 创建。