itemgetter add dict example (GH-1280)

This commit is contained in:
WeizhongTu 2018-04-13 09:33:08 +08:00 committed by Ned Deily
parent 04e8293465
commit ffa2c3e2c4
1 changed files with 2 additions and 0 deletions

View 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')