title: How to sort file contents into list
body: <p>I need a solution to sort my file like the following:</p>
  
  <pre><code>Super:1,4,6
  Superboy:2,4,9
  </code></pre>
  
  <p>My file at the moment looks like this:</p>
  
  <pre><code>Super:1
  Super:4
  Super:6
  </code></pre>
  
  <p>I need help to keep track of the scores for each member of the class obtains in the quiz. There are
  three classes in the school and the data needs to be kept separately for each class.</p>
  
  <p>My code is below:</p>
  
  <pre><code>className = className +(".txt")#This adds .txt to the end of the file so the user is able to create a file under the name of their chosen name.
  
  file = open(className , 'a')   #opens the file in 'append' mode so you don't delete all the information
  name = (name)
  file.write(str(name + " : " )) #writes the information to the file
  file.write(str(score))
  file.write('\n')
  file.close()    #safely closes the file to save the information
  </code></pre>