Listing 1. Looping through a Dictionary
>>> legends = { ('Poe', 'author'):
(1809, 1849, 1976),
... ('Gaudi', 'architect'):
(1852, 1906, 1987),
... ('Freud', 'psychoanalyst'):
(1856, 1939, 1990) }
...
>>> for eachLegend in legends:
... print 'Name: %s\tOccupation: %s' % eachLegend
... print ' Birth: %s\tDeath: %s\tAlbum:
%s\n'
% legends[eachLegend]
...
Name: Freud Occupation: psychoanalyst
Birth: 1856 Death: 1939 Album: 1990
Name: Poe Occupation: author
Birth: 1809 Death: 1849 Album: 1976
Name: Gaudi Occupation: architect
Birth: 1852 Death: 1906 Album: 1987