Persistence and Serialization Modules
dbm.dumb
Implements a portable DBM-style byte mapping using ordinary files, useful when native database backends are missing. It is not designed for high-performance or concurrent database access. A base filename may correspond to several files; close the database before copying its files.
Formal Syntax & Structure
python syntaxpython
import dbm.dumbReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import dbm.dumbfrom tempfile import TemporaryDirectoryfrom pathlib import Pathwith TemporaryDirectory() as folder: path = str(Path(folder)/"store") with dbm.dumb.open(path, "n") as db: db[b"count"] = b"3" with dbm.dumb.open(path, "r") as db: print(db[b"count"].decode("ascii"))