title: Sorting and aligning the contents of a text file in Python
body: <p>In my program I have a text file that I read from and write to. However, I would like to display the contents of the text file in an aligned and sorted manner. The contents currently read:</p>
  
  <pre><code>Emily, 6
  Sarah, 4
  Jess, 7
  </code></pre>
  
  <p>This is my code where the text file in read and printed:</p>
  
  <pre><code>elif userCommand == 'V':
      print "High Scores:"
      scoresFile = open("scores1.txt", 'r')
      scores = scoresFile.read().split("\n")
      for score in scores:
          print score
      scoresFile.close()
  </code></pre>
  
  <p>Would I have to convert this information into lists in order to be able to do this? If so, how do I go about doing this? </p>
  
  <p>When writing to the file, I have added a '\n' character to the end, as each record should be printed on a new line. </p>
  
  <p>Thank you</p>