title: Breaking a list in to parts by subject
body: <p>I have a list of dictionaries. Each list can be assumed to have dictionaries of the same format. Let's call that format:</p>
  
  <pre><code>dict_sample={'a':0,'b':1}
  </code></pre>
  
  <p>Let's also say that <code>a</code> is a random integer, while b can be one of a few numbers (Or strings, for that matter). I'm wanting to sort all of the <code>a</code> values by <code>b</code>. For instance, if I had a list as follows:</p>
  
  <pre><code>a    b
  54   1
  25   0
  53   1
  532  2
  132  0
  
  list=[{'a':54,'b':1},{'a':25,'b':0},{'a':53,'b':1},{'a':532,'b':2},{'a':132,'b':0}]
  </code></pre>
  
  <p>I would like to break this down in to 3 lists. The lists would include (Order not important)</p>
  
  <pre><code>0 list-&gt; [25,132]
  1 list-&gt; [54,53]
  2 list-&gt; [532]
  </code></pre>
  
  <p>I know I can break all <code>a</code>'s from the list as follows, but I can't quite figure out an elegant solution to sorting the <code>a</code>'s by <code>b</code>'s. Any suggestions? My code so far looks like:</p>
  
  <pre><code>[row['a'] for row in list]
  </code></pre>
  
  <p>What I would like is something like this:</p>
  
  <pre><code>index=0      #This could be looped through, or just chosen for one specific value
  [row['a'] if row['b']==index for row in list]
  </code></pre>