Is there a smart pythonic way to check if there is an item (key,value) in a dict?
a={\'a\':1,\'b\':2,\'c\':3}
b={\'a\':1}
c={\'a\':2}
b in a:
--> True
c
Converting my comment into an answer :
Use the dict.get method which is already provided as an inbuilt method (and I assume is the most pythonic)
>>> dict = {'Name': 'Anakin', 'Age': 27}
>>> dict.get('Age')
27
>>> dict.get('Gender', 'None')
'None'
>>>
As per the docs -
get(key, default) - Return the value for key if key is in the dictionary, else default. If default is not given, it defaults to None, so that this method never raises a KeyError.