how to scrutch a dict()

Phlip phlip2005 at
Thu Oct 21 15:28:24 CEST 2010

> for k in [k for k, v in d.items() if v is None]:
>   del d[k]

Tx everyone!

And I forgot about shadowing dict(), I forgot about del d[k], and I
didn't know Python had "dict comprehensions" yet.

Anyway this one might become the winner.

More information about the Python-list mailing list