In Python 2, when I wanted to know if a dict
had a given key, I used the has_key
method.
if kwargs.has_key("code"):
self.code = kwargs.code
However, now that I was running the same script in Python 3, I got the following error:
AttributeError: 'dict' object has no attribute 'has_key'
In Python 3, has this has_key
method been removed? Which option do I have now?