We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e9e8c9b commit e398da9Copy full SHA for e398da9
1 file changed
Doc/library/dbm.rst
@@ -91,10 +91,8 @@ then prints out the contents of the database::
91
# Notice how the value is now in bytes.
92
assert db['www.cnn.com'] == b'Cable News Network'
93
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)
+ # Often-used methods of the dict interface work too.
+ print(db.get('python.org', b'not present'))
98
99
# Storing a non-string key or value will raise an exception (most
100
# likely a TypeError).
0 commit comments