summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial/datastructures.rst
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-31 03:46:28 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-31 03:46:28 (GMT)
commite0906d13c3cfe4286a7b5fb05e9cc3fcb65c77e4 (patch)
tree2aefcd1e01263f1084d412678a5dcc82e6d9a052 /Doc/tutorial/datastructures.rst
parent7aa02e6590e2155e8f72bb4491c96db40a50cac3 (diff)
downloadcpython-e0906d13c3cfe4286a7b5fb05e9cc3fcb65c77e4.zip
cpython-e0906d13c3cfe4286a7b5fb05e9cc3fcb65c77e4.tar.gz
cpython-e0906d13c3cfe4286a7b5fb05e9cc3fcb65c77e4.tar.bz2
A few more fixes to the tutorial
Diffstat (limited to 'Doc/tutorial/datastructures.rst')
-rw-r--r--Doc/tutorial/datastructures.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index 77088f3..20bade5 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -400,12 +400,12 @@ Here is a small example using a dictionary::
>>> tel['irv'] = 4127
>>> tel
{'guido': 4127, 'irv': 4127, 'jack': 4098}
- >>> tel.keys()
+ >>> list(tel.keys())
['guido', 'irv', 'jack']
- >>> tel.has_key('guido')
- True
>>> 'guido' in tel
True
+ >>> 'jack' not in tel
+ False
The :func:`dict` constructor builds dictionaries directly from lists of
key-value pairs stored as tuples. When the pairs form a pattern, list
@@ -435,10 +435,10 @@ Looping Techniques
==================
When looping through dictionaries, the key and corresponding value can be
-retrieved at the same time using the :meth:`iteritems` method. ::
+retrieved at the same time using the :meth:`items` method. ::
>>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
- >>> for k, v in knights.iteritems():
+ >>> for k, v in knights.items():
... print(k, v)
...
gallahad the pure