file_contents = eval(file.readlines().pop(0))
file_contents_values = list(file_contents.values())
year = sorted(set(map(lambda x: x[0], file_contents_values)))
file_contents_values_grouped_by_year = [[y[1] for y in file_contents_values if
    y[0] == x] for x in year]
output = dict(zip(year, file_contents_values_grouped_by_year))
for NameRank in list(output.values()):
    NameRank.sort(key=lambda x: int(x.split()[1]))
pprint.pprint(output)
Parsing, Aggregating & Sorting text file in Python