Walk through dictionary keys?
Tim Roberts
timr at probo.com
Wed Dec 20 01:53:02 EST 2000
Emile van Sebille <emile at fenx.com> wrote:
>I'm not sure when or how long this has been in, but the cvs version of
>dict's has a popitem method that looks like it does what you want.
>
>d = {1:11,2:22,3:33,4:44}
>for i in xrange(len(d)):
> print d.popitem()
But is popitem destructive? That is, when that loop is complete, is d
empty?
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list