how to scrutch a dict()

Phlip phlip2005 at gmail.com
Thu Oct 21 09:28:24 EDT 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