Way for see if dict has a key

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Fri Jun 30 06:19:46 EDT 2006


Hi ng,
what the preferred way for see if the dict has a key?
We have a lot of solutions:

key in dict
key in dict.keys()
dict.has_key(key)
...

but what the better or the more "pythonic"?

Thanks,
Michele



More information about the Python-list mailing list