summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-28 11:53:25 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-28 11:53:25 (GMT)
commite398da9ad0533d4bdca43aca8a7ff96cd02b7cfa (patch)
treee7d9b685c335ef408cc4f7c61b15d51be1c91353 /Doc
parente9e8c9bda486c2694e9dfa462c0d43a3476e5d7c (diff)
downloadcpython-e398da9ad0533d4bdca43aca8a7ff96cd02b7cfa.zip
cpython-e398da9ad0533d4bdca43aca8a7ff96cd02b7cfa.tar.gz
cpython-e398da9ad0533d4bdca43aca8a7ff96cd02b7cfa.tar.bz2
#10609: fix non-working dbm example.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/dbm.rst6
1 files changed, 2 insertions, 4 deletions
diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst
index 67c0025..0cd873e 100644
--- a/Doc/library/dbm.rst
+++ b/Doc/library/dbm.rst
@@ -91,10 +91,8 @@ then prints out the contents of the database::
# Notice how the value is now in bytes.
assert db['www.cnn.com'] == b'Cable News Network'
- # Loop through contents. Other dictionary methods
- # such as .keys(), .values() also work.
- for k, v in db.iteritems():
- print(k, '\t', v)
+ # Often-used methods of the dict interface work too.
+ print(db.get('python.org', b'not present'))
# Storing a non-string key or value will raise an exception (most
# likely a TypeError).