I got two different test with different test scores. I store both test in a separate list. How can I merge both list and get the final result?
returnn = sorted(returnscore, key=itemgetter('score'), reverse=True)
for rij in returnn:
print rij
Output:
{'E-mail': '[email protected]', 'score': 10}
{'E-mail': '[email protected]', 'score': 10}
{'E-mail': '[email protected]', 'score': 10}
{'E-mail': '[email protected]', 'score': 10}
{'E-mail': '[email protected]', 'score': 5}
{'E-mail': 'noreply@com', 'score': 5}
{'E-mail': 'marketing@nl', 'score': 5}
spff = sorted(spfscore, key=itemgetter('score'), reverse=True)
for rij in spff:
print rij
Output:
{'E-mail': '[email protected]', 'score': 3}
{'E-mail': '[email protected]', 'score': 0}
{'E-mail': '[email protected]', 'score': 7}
{'E-mail': '[email protected]', 'score': 0}
{'E-mail': '[email protected]', 'score': 0}
{'E-mail': 'noreply@com', 'score': 0}
{'E-mail': 'arketing@nl', 'score': 1}
The output I want is:
{'E-mail': '[email protected]', 'score': 50}
{'E-mail': '[email protected]', 'score': 5}
{'E-mail': 'noreply@com', 'score': 5}
{'E-mail': 'arketing@nl', 'score': 6}
I been trying to figure this out for a couple of hours. I just don`t understand how I can count the scores and remove the duplicates after.