from collections import OrderedDict
l = [('Monkey', 71), ('Monkey', 78), ('Ostrich', 80), ('Ostrich', 96), ('Ant', 98)]
d = OrderedDict()
for i, j in l:
d[i] = j
print d
OrderedDict([('Monkey', 78), ('Ostrich', 96), ('Ant', 98)])
The expected 'd' should be:
OrderedDict([('Monkey', (71,78)), ('Ostrich', (80,96)), ('Ant', 98)])
No problem if all values are tupled or listed.