title: Alphabetically sorting a dictionary
body: <p>I have researched a bit around this; however, when I tried implementing it into my code, I was unsuccessful. This is what I have so far:</p>
  
  <pre><code>f = open('ClassA.txt', 'r')
  dictionary = {}
  for line in f:
      firstpart, secondpart = line.strip().split(':')
      dictionary[firstpart.strip()] = secondpart.strip()
  f.close()
  sorted_dict = {k: sorted(v) for k, v in dictionary.items()}
  print (sorted_dict)
  </code></pre>
  
  <p><code>ClassA.txt</code> would contain for example:</p>
  
  <pre><code>Jakub Scored: 10
  Dan Scored: 10
  Jake Scored: 9
  Harry Scored: 5
  </code></pre>
  
  <p>And I want the names to come alphabetically in order. However, when I print the <code>sorted_dict</code> it comes up with:</p>
  
  <pre><code>{'Jakub Scored': ['0', '1'], 
   'Dan Scored': ['0', '1'], 
   'Harry Scored': ['5'], 
   'Jake Scored': ['9']}
  </code></pre>
  
  <p>Not only isn't it in order, but also the people who scored <code>10</code> for some reason are printed incorrectly (backwards).</p>