iteritems() and enumerate()

Fredrik Lundh fredrik at pythonware.com
Thu Jan 20 02:46:05 EST 2005


Xah Lee wrote:

> Python has iteritems() and enumerate() to be used in for loops.
>
> can anyone tell me what these are by themselves, if anything?

iteritems() is a dictionary method, which returns a lazily constructed
sequence of all (key, value) pairs in the dictionary.

enumerate(seq) is a function that returns a lazily constructed list of
(index, value) pairs for all values in a sequence.

check the relevant sections of the library reference for details.

</F> 






More information about the Python-list mailing list