<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>

This snippet will do it. If you're going to do it frequently, you might want to make a 'sortkeys' method to make it easier on the eyes.
```
```
keys = list(d.keys())
keys.sort()
for key in keys:
    print d[key]
```
```
Edit:
dF's solution
is better -- I forgot all about
```
sorted()
```
.