Commit 70c2dd30 authored by Raymond Hettinger's avatar Raymond Hettinger Committed by GitHub

Show example of itemgetter() applied to a dictionary (#3431)

parent 8e0ad46b
......@@ -321,6 +321,9 @@ expect a function argument.
>>> itemgetter(slice(2,None))('ABCDEFG')
'CDEFG'
>>> soldier = dict(rank='captain', name='dotterbart')
>>> itemgetter('rank')(soldier)
'captain'
Example of using :func:`itemgetter` to retrieve specific fields from a
tuple record:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment