Way for see if dict has a key

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Fri Jun 30 12:59:22 CEST 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