title: sort csv by column
body: <p>I want to sort a CSV table by date. Started out being a simple task:</p>
  <pre><code>import sys
  import csv
  
  reader = csv.reader(open(&quot;files.csv&quot;), delimiter=&quot;;&quot;)
  
  for id, path, title, date, author, platform, type, port in reader:
      print date
  </code></pre>
  <p>I used Python's CSV module to read in a file with that structure:</p>
  <pre class="lang-none prettyprint-override"><code>id;file;description;date;author;platform;type;port
  </code></pre>
  <ul>
  <li>The date is ISO-8601, therefore I can sort it quite easily without parsing: 2003-04-22 e. g.</li>
  <li>I want to sort the by date, newest entries first</li>
  <li>How do I get this reader into a sortable data-structure? I think with some effort I could make a datelist: datelist += date, split and sort. However I have to re-identify the complete entry in the CSV table. It's not just sorting a list of things.</li>
  <li>csv doesn't seem to have a built in sorting function</li>
  </ul>
  <p>The optimal solution would be to have a CSV client that handles the file like a database. I didn't find anything like that.</p>
  <p>I hope somebody knows some nice sorting magic here ;)</p>