On Tue, May 11, 2010 at 11:08 AM, Ulrich Eckhardt
<eckha...@satorlaser.com> wrote:
> My first approach was to simply postpone removing the elements, but I was
> wondering if there was a more elegant solution.

Iterate over something other than the actual dictionary, like this:

d = {1: 'one', 2: 'two', 3: 'three'}

for k in d.keys():
    if d[k] == 'two':
        d.pop(k)


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

Reply via email to