looping through the keys of a dictionary

Tist Verdonck tist.verdonck at mailandnews.com
Tue Aug 21 16:51:48 CEST 2001


Is there a way to loop through the keys of a dictionary (whitout using
a list containing all those keys)?

e.g. mydict = {'123':[1,9,13],'125':[6,8],'225':[5]}

where '123','125' and '225' are serial numbers
and 1,9,13
    6,8
    and 5 are positions of elements in a list with the same serial
number

I have to merge the elements with position 1,9 and 13 // 8 and 6 //
element 5 stays the same.

(I only need to know how to loop through the keys, the rest is a
little explanation)

thanks,
Tist Verdonck
tist.verdonck at mailandnews.com



More information about the Python-list mailing list