title: How to sort a dictionary to print from highest value to lowest for each key?
body: <p>txt would contain a something like this:</p>
  
  <pre><code>Matt Scored: 10
  Jimmy Scored: 3
  James Scored: 9
  Jimmy Scored: 8
  ....
  </code></pre>
  
  <p>The code I managed to put together (quite new to python) is here:</p>
  
  <pre><code>from collections import OrderedDict
  #opens the class file in order to create a dictionary
  dictionary = {}
  #splits the data so the name is the key while the score is the value
  f = open('ClassA.txt', 'r')
  d = {}
  for line in f:
      firstpart, secondpart = line.strip().split(':')
      dictionary[firstpart.strip()] = secondpart.strip()
      columns = line.split(": ")
      letters = columns[0]
      numbers = columns[1].strip()
      if d.get(letters):
          d[letters].append(numbers)
      else:
          d[letters] = list(numbers)
  #sorts the dictionary so it has a alphabetical order
  sorted_dict = OrderedDict(sorted(d.items()))
  print (sorted_dict)
  </code></pre>
  
  <p>And the problem I encountered is when trying to print the dictionary with the names and the scores from highest to lowest is that it will either only print the name with the highest score when using the <code>max</code> function or if im using the <code>itemgetter</code> it only seems to work for lowest to highes. So I was wondering if anyone would be able to help me out. Anything is appreciated, explain it if possible :)</p>