Get list of dictionary elements ordered by dictionary key
<p>I have a dictionary <code>d</code> for which the keys are all strings. Now when I do:</p>

<pre><code>for key in d:
   print(d[key])
</code></pre>

<p>I get the elements of <code>d</code> is some "random" order. How can I force the element of <code>d</code> to come out sorted by the lexicographical order?</p>
