mirror of https://github.com/python/cpython.git
fix more indentation
This commit is contained in:
parent
ffec810d88
commit
c16f8b33e0
|
@ -369,12 +369,12 @@ expect a function argument.
|
||||||
Example of using :func:`itemgetter` to retrieve specific fields from a
|
Example of using :func:`itemgetter` to retrieve specific fields from a
|
||||||
tuple record:
|
tuple record:
|
||||||
|
|
||||||
>>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]
|
>>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]
|
||||||
>>> getcount = itemgetter(1)
|
>>> getcount = itemgetter(1)
|
||||||
>>> map(getcount, inventory)
|
>>> map(getcount, inventory)
|
||||||
[3, 2, 5, 1]
|
[3, 2, 5, 1]
|
||||||
>>> sorted(inventory, key=getcount)
|
>>> sorted(inventory, key=getcount)
|
||||||
[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]
|
[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]
|
||||||
|
|
||||||
|
|
||||||
.. function:: methodcaller(name[, args...])
|
.. function:: methodcaller(name[, args...])
|
||||||
|
|
Loading…
Reference in New Issue