Grant Edwards wrote:
Here's another choice, that's sometimes handy:

d = {1:'one',2:'two',3:'three'}
for k,v in d.items():

.... print k,v
.... 1 one
2 two
3 three


I wouldn't recommend this for large dictionaries.

Yes, for large dictionaries, you should use:

for k, v in d.iteritems():
    print k, v

STeVe
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to