summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Doc/library/operator.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index 8121b480cb..76335b179c 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -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: