The following should solve your problem. Note that if the names are not exactly the same they will be counted as different names. In your original post, the second item has the name ‘William’ whilst the first has the name ‘William ‘ which has a space after the m!!!
data = [{'desig': '', 'name': 'William'}, {'desig': 'Chairman of the Board', 'name': 'William'},
{'desig': '', 'name': 'English'}, {'desig': 'Director', 'name': 'English'},
{'desig': '', 'name': 'Charles '}]
cleaned_data = []
names_added = []
for entry in data:
if entry['name'] in names_added:
if entry['desig'] != '': # the != '' is actually not necessary, but included for clarity
i = names_added.index(entry['name'])
cleaned_data[i]=entry
else:
cleaned_data.append(entry)
names_added.append(entry['name'])
print(cleaned_data)
solved Remove Duplicate List Dictionary based on the Designations