AttributeError: 'dict' object has no attribute 'has_key'



Python 3.1 version does not support 'has_key' attribute you can use alternate following code

 

dist= {
  "key1": "f",
  "key2": "m",
  "key3": "g"
}
if 'key' not in dist:
   print('Not in dist')

Tags:

Share:

Related posts