Way for see if dict has a key

Fredrik Lundh fredrik at pythonware.com
Fri Jun 30 07:10:44 EDT 2006


Michele Petrazzo wrote:

> >> key in dict
> >
> > new syntax (2.3 and later).
>
> So, following it, it can be used for the operations like len?

what's "it" in this sentence?

> len(dict) -> len(dict.keys()) ?

len(dict.keys()) is a lousy way to spell len(dict).

</F> 






More information about the Python-list mailing list