Way for see if dict has a key

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Fri Jun 30 06:59:22 EDT 2006


Fredrik Lundh wrote:
> Michele Petrazzo wrote:
> 
>> what the preferred way for see if the dict has a key?
>> We have a lot of solutions:
>>
>> key in dict
> 
> new syntax (2.3 and later).
> 

So, following it, it can be used for the operations like len?

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

Thanks,
Michele



More information about the Python-list mailing list