Iterating over the data items in a dict.

Gaute B Strokkenes gs234 at cam.ac.uk
Mon Nov 6 09:00:26 EST 2000


I would like to iterate over the data items, not the keys, in a dict.
The closest I can get is:

        for n in mydict.keys():
            i = mydict[n]
            do_something_useful(i)

However, this seems a bit awkward.

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
Yow!  Are we wet yet?



More information about the Python-list mailing list