title: how to sort data from a file having two columns in python
body: <p>I have file containing data like:  </p>
  
  <pre><code>12, 9
  13, 9  
  45, 23
  1, 4 
  0, 8
  91, 45
  638, 56
  123, 3  
  2, 9
  </code></pre>
  
  <p>now what I need to do is sort it like:  </p>
  
  <pre><code>0, 8
  1, 4
  2, 9
  12, 9
  13, 9
  45, 23
  91, 45
  123, 3
  638, 56
  </code></pre>
  
  <p>I have tried using:    </p>
  
  <pre><code>import sys,csv    
  import operator
  reader = csv.reader(open('filename.txt'),delimiter=',')
  sort = sorted(reader,key=operator.itemgetter(0),reverse=False)
  </code></pre>
  
  <p>but this is not working for me. It arranging the column based on the 1st location not arranging as I wanted.i.e. :    </p>
  
  <pre><code>0, 8
  1, 4
  12, 9
  123, 3
  13, 9
  2, 9
  45, 23
  638, 56
  91, 45
  </code></pre>
  
  <p>please help.</p>