Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e398da9

Browse files
committed
#10609: fix non-working dbm example.
1 parent e9e8c9b commit e398da9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Doc/library/dbm.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@ then prints out the contents of the database::
9191
# Notice how the value is now in bytes.
9292
assert db['www.cnn.com'] == b'Cable News Network'
9393

94-
# Loop through contents. Other dictionary methods
95-
# such as .keys(), .values() also work.
96-
for k, v in db.iteritems():
97-
print(k, '\t', v)
94+
# Often-used methods of the dict interface work too.
95+
print(db.get('python.org', b'not present'))
9896

9997
# Storing a non-string key or value will raise an exception (most
10098
# likely a TypeError).

0 commit comments

Comments
 (0)