Walk through dictionary keys?

Tim Roberts timr at probo.com
Wed Dec 20 07:53:02 CET 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
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.

More information about the Python-list mailing list