How do I sort a list of dictionaries by more than one element
<p>This thread <a href="http://stackoverflow.com/questions/72899/in-python-how-do-i-sort-a-list-of-dictionaries-by-values-of-the-dictionary">In Python how do I sort a list of dictionaries by values of the dictionary?</a> explains very clearly how to sort a list of dictionaries.  In summary for,</p>

<pre><code>[{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]
</code></pre>

<p>You do:</p>

<pre><code>newlist = sorted(list_to_be_sorted, key=lambda k: k['name']) 
</code></pre>

<p>However, I have much more elements in my dictionary and I need to sort by four of them - not just one.  Any tips how to do this?</p>

<p>Note: I read further into the thread and this suggestion:</p>

<pre><code>sortedlist = sorted(input, key=lambda elem: "%02d %s" % (elem['age'], elem['name']))
</code></pre>

<p>does not work.  It gives error:</p>

<pre><code>TypeError: list indices must be intergers, not str
</code></pre>

<p>I try various versions of this and to no avail.</p>

<p>Any help appreciated,</p>
