diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 8121b480cb6574..76335b179c58f8 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: