Hi Dmitrey,
I think what you're looking for is myDict.items(), or myDict.iteritems().
Cheers,
Rami
On Tue, 11 Aug 2009 12:15:13 -0700, dmitrey <dmitrey.kros...@scipy.org>
wrote:
hi all,
which method should I use to get iterator over (key, value) pairs for
Python dict, Python v 2.6 and above?
Of course I could use
for key in myDict.keys():
value = myDict.values()
# do something with the pair key, value
but searching each time for the value take some cputime that is
serious for the task involved
IIRC in python 2.5 I have something like keyvalues(), but I don't see
something like that in current dir(myDict).
Thank you in advance, D.
--
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
--
http://mail.python.org/mailman/listinfo/python-list