Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ffa2c3e

Browse files
twz915ned-deily
authored andcommitted
itemgetter add dict example (GH-1280)
1 parent 04e8293 commit ffa2c3e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Doc/library/operator.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ expect a function argument.
315315
method. Dictionaries accept any hashable value. Lists, tuples, and
316316
strings accept an index or a slice:
317317

318+
>>> itemgetter('name')({'name': 'tu', 'age': 18})
319+
'tu'
318320
>>> itemgetter(1)('ABCDEFG')
319321
'B'
320322
>>> itemgetter(1,3,5)('ABCDEFG')

0 commit comments

Comments
 (0)