]> granicus.if.org Git - python/commitdiff
itemgetter add dict example (GH-1280)
authorWeizhongTu <tuweizhong@163.com>
Fri, 13 Apr 2018 01:33:08 +0000 (09:33 +0800)
committerNed Deily <nad@python.org>
Fri, 13 Apr 2018 01:33:08 +0000 (21:33 -0400)
Doc/library/operator.rst

index e4d6d05a23a7c40f8afab59d7c821e4a6850f3e6..250cbb6b7c07370fb3e683dad5064cdfa9c0c8c3 100644 (file)
@@ -315,6 +315,8 @@ expect a function argument.
    method.  Dictionaries accept any hashable value.  Lists, tuples, and
    strings accept an index or a slice:
 
+      >>> itemgetter('name')({'name': 'tu', 'age': 18})
+      'tu'
       >>> itemgetter(1)('ABCDEFG')
       'B'
       >>> itemgetter(1,3,5)('ABCDEFG')