diff options
Diffstat (limited to 'Doc/library/bsddb.rst')
-rw-r--r-- | Doc/library/bsddb.rst | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Doc/library/bsddb.rst b/Doc/library/bsddb.rst index c5c6276..aff1d5b 100644 --- a/Doc/library/bsddb.rst +++ b/Doc/library/bsddb.rst @@ -105,6 +105,11 @@ Once instantiated, hash, btree and record objects support the same methods as dictionaries. In addition, they support the methods listed below. +.. describe:: key in bsddbobject + + Return ``True`` if the DB file contains the argument as a key. + + .. method:: bsddbobject.close() Close the underlying file. The object can no longer be accessed. Since there @@ -119,11 +124,6 @@ dictionaries. In addition, they support the methods listed below. returned is different for different file formats. -.. method:: bsddbobject.has_key(key) - - Return ``1`` if the DB file contains the argument as a key. - - .. method:: bsddbobject.set_location(key) Set the cursor to the item indicated by *key* and return a tuple containing the @@ -169,7 +169,8 @@ Example:: >>> import bsddb >>> db = bsddb.btopen('/tmp/spam.db', 'c') - >>> for i in range(10): db['%d'%i] = '%d'% (i*i) + >>> for i in range(10): + ... db[str(i)] = '%d' % (i*i) ... >>> db['3'] '9' @@ -186,7 +187,7 @@ Example:: >>> db.previous() ('1', '1') >>> for k, v in db.iteritems(): - ... print k, v + ... print(k, v) 0 0 1 1 2 4 |