itemgetter add dict example (GH-1280)
This commit is contained in:
parent
04e8293465
commit
ffa2c3e2c4
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue