We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7dc42b6 commit 8b01fc8Copy full SHA for 8b01fc8
Doc/library/shelve.rst
@@ -262,6 +262,23 @@ object)::
262
263
d.close() # close it
264
265
+The :func:`shelve.open` function automatically selects an available DBM backend
266
+implementation. You can explicitly select the DBM backend by using
267
+:class:`shelve.Shelf` with a specific backend:
268
+
269
+.. code-block:: python
270
271
+ import shelve
272
+ import dbm
273
274
+ # Use SQLite3 as DBM backend
275
+ with shelve.Shelf(dbm.sqlite3.open("data.shelf", "c")) as shelf:
276
+ shelf["int"] = 4
277
278
+ # Use GNU DBM as backend
279
+ with shelve.Shelf(dbm.gnu.open("data.gnu", "c")) as shelf:
280
+ shelf["foo"] = "bar"
281
282
283
Exceptions
284
----------
0 commit comments