title: In Python, how can you easily retrieve sorted items from a dictionary?
body: <p>Dictionaries unlike lists are not ordered (and do not have the 'sort' attribute). Therefore, you can not rely on getting the items in the same order when first added. </p>
  
  <p>What is the easiest way to loop through a dictionary containing strings as the key value and retrieving them in ascending order by key?</p>
  
  <p>For example, you had this:</p>
  
  <pre><code>d = {'b' : 'this is b', 'a': 'this is a' , 'c' : 'this is c'}
  </code></pre>
  
  <p>I want to print the associated values in the following sequence sorted by key:</p>
  
  <pre><code>this is a
  this is b
  this is c
  </code></pre>