The first Dict is fixed.This Dict will remain as it is List of Countries with there Short Names.
firstDict={'ERITREA': 'ER', 'LAOS': 'LA', 'PORTUGAL': 'PT', "D'IVOIRE": 'CI', 'MONTENEGRO': 'ME', 'NEW CALEDONIA': 'NC', 'SVALBARD AND JAN MAYEN': 'SJ', 'BAHAMAS': 'BS', 'TOGO': 'TG', 'CROATIA': 'HR', 'LUXEMBOURG': 'LU', 'GHANA': 'GH'}
However This Tuple result has multiple Dict inside it.This is the format in which MySQLdb returns result:
result =({'count': 1L, 'country': 'Eritrea'}, {'count': 1L, 'country': 'Togo'}, {'count': 1L, 'country': 'Sierra Leone'}, {'count': 3L, 'country': 'Bahamas'}, {'count': 1L, 'country': 'Ghana'})
Now i want to compare these both results With COUNTRY Names and If 'Country' in Result is present in firstDict then put the value.else put the 0
The result desired is:
mainRes={'ER':1,'TG':1,'BS':3,'GH':0,'LU':0}