_gdbm - This module provides an interface to the GNU DBM (GDBM) library.
| Use Case | Command | Description |
|---|---|---|
| Open for reading | open('db', 'r') | Open existing database read-only |
| Open for read/write | open('db', 'w') | Open existing database read-write |
| Open or create | open('db', 'c') | Open existing or create new database |
| Create new database | open('db', 'n') | Always create a new empty database |
| Fast mode (no sync) | open('db', 'cf') | Open with fast mode (faster writes, crash risk) |
| Sync mode | open('db', 'cs') | Open with synchronized writes |
| Disable locking | open('db', 'cu') | Open without file locking |
| Force sync | db.sync() | Force unwritten data to disk |
https://docs.python.org/3.10/library/_gdbm.html
The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.
This module is quite similar to the dbm module, but uses GDBM instead to provide some additional functionality. Please note that the file formats created by GDBM and dbm are incompatible.
GDBM objects behave like mappings (dictionaries), except that keys and values are always immutable bytes-like objects or strings. Printing a GDBM object doesn't print the keys and values, and the items() and values() methods are not supported.
builtins.OSError(builtins.Exception) → error
Method resolution order:
errorbuiltins.OSErrorbuiltins.Exceptionbuiltins.BaseExceptionbuiltins.objectData descriptors defined here:
__weakref__ — list of weak references to the object (if defined)Methods inherited from builtins.OSError:
__init__(self, /, *args, **kwargs) — Initialize self. See help(type(self)) for accurate signature.__reduce__(...) — Helper for pickle.__str__(self, /) — Return str(self).Static methods inherited from builtins.OSError:
__new__(*args, **kwargs) from builtins.type — Create and return a new object. See help(type) for accurate signature.Data descriptors inherited from builtins.OSError:
characters_writtenerrno — POSIX exception codefilename — exception filenamefilename2 — second exception filenamestrerror — exception strerrorMethods inherited from builtins.BaseException:
__delattr__(self, name, /) — Implement delattr(self, name).__getattribute__(self, name, /) — Return getattr(self, name).__repr__(self, /) — Return repr(self).__setattr__(self, name, value, /) — Implement setattr(self, name, value).__setstate__(...)with_traceback(...) — Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.Data descriptors inherited from builtins.BaseException:
__cause__ — exception cause__context__ — exception context__dict____suppress_context____traceback__argsopen(filename, flags='r', mode=438, /)
Open a dbm database and return a dbm object.
The filename argument is the name of the database file.
The optional flags argument can be:
'r' — open an existing database for reading only (default)'w' — open an existing database for reading and writing'c' — create the database if it doesn't exist'n' — always create a new empty databaseSome versions of gdbm support additional flags which must be appended to one of the flags described above. The module constant open_flags is a string of valid additional flags.
'f' — fast mode; altered data not automatically written to disk after every change. Faster writes, but risk of inconsistent database if crash. Use sync() to force unwritten data to disk.'s' — synchronized mode; all database operations synchronized to disk.'u' — disable locking of the database file.The optional mode argument is the Unix mode of the file, used only when the database has to be created. It defaults to octal 0o666.
open_flags = 'rwcnfsu'
/usr/lib/python3.10/lib-dynload/_gdbm.cpython-310-x86_64-linux-gnu.so
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 16:58 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)