title: How do I sort objects in a python dictionary when the value is an object?
body: <p>I have a python dict that looks like this:</p>
  <pre><code>file_dict = {'a.txt' : &lt;#:text_object&gt;, 'b.txt': &lt;#:text_object&gt;, 'c.txt': &lt;#:text_object&gt;}
  </code></pre>
  <p>The value text_object is an object that contains a bunch of analytic data about the file. It's an object like this...</p>
  <pre><code>class text_object:
       #...a bunch of methods and setters...
       def get_word_count(self):
            return self.word_count #integer value
  </code></pre>
  <p>These objects are in a dict so that I can find specific files and their corresponding data quickly via their filename. I want to sort the file_dict in word_count order so I can output the objects with the smallest word count to help find anomalies in the data collection process.</p>
  <p>How do I sort the file_dict based on the value in the text_object.get_word_count() classes stored within it?</p>