diff options
author | WeizhongTu <tuweizhong@163.com> | 2018-04-13 01:33:08 (GMT) |
---|---|---|
committer | Ned Deily <nad@python.org> | 2018-04-13 01:33:08 (GMT) |
commit | ffa2c3e2c40acae07aca5b77f2c0e8c14a00438d (patch) | |
tree | b3d6824108d6f52869704223979f5813b3066865 | |
parent | 04e82934659487ecae76bf4a2db7f92c8dbe0d25 (diff) | |
download | cpython-ffa2c3e2c40acae07aca5b77f2c0e8c14a00438d.zip cpython-ffa2c3e2c40acae07aca5b77f2c0e8c14a00438d.tar.gz cpython-ffa2c3e2c40acae07aca5b77f2c0e8c14a00438d.tar.bz2 |
itemgetter add dict example (GH-1280)
-rw-r--r-- | Doc/library/operator.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index e4d6d05..250cbb6 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -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') |