mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Reorder the entries to put the type specific technique last.
This commit is contained in:
parent
016878aea6
commit
4c8d392bc1
1 changed files with 10 additions and 10 deletions
|
@ -577,16 +577,6 @@ keyword arguments::
|
|||
Looping Techniques
|
||||
==================
|
||||
|
||||
When looping through dictionaries, the key and corresponding value can be
|
||||
retrieved at the same time using the :meth:`iteritems` method. ::
|
||||
|
||||
>>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
|
||||
>>> for k, v in knights.iteritems():
|
||||
... print k, v
|
||||
...
|
||||
gallahad the pure
|
||||
robin the brave
|
||||
|
||||
When looping through a sequence, the position index and corresponding value can
|
||||
be retrieved at the same time using the :func:`enumerate` function. ::
|
||||
|
||||
|
@ -633,6 +623,16 @@ returns a new sorted list while leaving the source unaltered. ::
|
|||
orange
|
||||
pear
|
||||
|
||||
When looping through dictionaries, the key and corresponding value can be
|
||||
retrieved at the same time using the :meth:`iteritems` method. ::
|
||||
|
||||
>>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
|
||||
>>> for k, v in knights.iteritems():
|
||||
... print k, v
|
||||
...
|
||||
gallahad the pure
|
||||
robin the brave
|
||||
|
||||
|
||||
.. _tut-conditions:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue