title: How do I convert a text file into a list then sort it with Python?
body: <p>I have a text file with the following lyrics:</p>
  
  <blockquote>
    <p>'First verse Im off till I'm off the island<br>
    i'm riding like autoban on autopilot<br>
    before I touch dirt I deal you all with kindness<br>
    my natual persona much worse'</p>
  </blockquote>
  
  <p>I want to convert it to a list, then sort it alphabetically, but what I keep getting is: <code>[[First', 'verse', 'Im', 'off', 'till, "I'm", 'off' , 'the', 'island'] [then it prints the third line], [then the second line], [then the fourth line]]</code></p>
  
  <p>and then it puts it into a list within a list <code>[[ text, text..., ]]</code></p>
  
  <p>How do I print it so it prints in order in one list and is sorted in
  alphabetical order using python code?  Here is what I have so far:</p>
  
  <pre><code>fname = raw_input("Enter file name: ")  #prompts user for .txt file
  fhand = open(fname)     #reads file
  NewList =  []    #creating new list to append to
  for line in fhand:    #for the lines in the text file, read them
      line.rstrip()   # strip the white space
      words = line.split()   #split the txt file into string words
  
      for word in words:      #for every word in txt file
          if words not in NewList:  #if not in the NewList
                  NewList.append(words) #then appended words to Newlist 
  
                  NewList.sort()    #sort it alphabetically
  
  print NewList   #then print the sorted list
  </code></pre>