title: Python 3 - I can't print my sorted list using the .strip() function successfully
body: <p>I want to print a list one word per line, but when I print the sorted version I can't seem to do that. My textfile just has five words, one on each line,</p>
  
  <pre><code>dog
  bit
  mailman
  cat
  anteater
  </code></pre>
  
  <p>Everything is fine in terms of code, it's just solving how to print it out correctly.</p>
  
  <pre><code>def letterSort(wordlist):
      letterbin = [[] for _ in range(26)]
      final = []
      for line in open(wordlist):
          word = line.strip().lower()
          firstLetter = word[0]
          index = ord(firstLetter) - ord('a')
          bins = letterbin[index]
          if not word in bins:
              bins += [word]
      for bins in letterbin:
          insertion_sort(bins)
          final += bins
      return final        
  
  def swap( lst, i, j ):
  
      temp = lst[i]
      lst[i] = lst[j]
      lst[j] = temp
  
  def insert( lst, mark ):
      index = mark
      while index &gt; -1 and lst[index] &gt; lst[index+1]:
          swap( lst, index, index+1 )
          index = index - 1
  
  def insertion_sort( lst ):
  
      for mark in range( len( lst ) - 1 ):
          insert( lst, mark )
  
  
  def main():
      wordlist = input("Enter text file name: ")
      print("Input words:", )
      for line in open(wordlist):
          print(line.strip())
      print("\n")
      print("Sorted words:", )
  
      for line in open(wordlist):
          print(letterSort(wordlist.strip()))
  
  
  main()
  </code></pre>
  
  <p>After all this this is the what I'm getting:</p>
  
  <pre><code>Enter text file name: wordlist.txt
  Input words:
  dog
  bit
  mailman
  cat
  anteater
  
  
  Sorted words:
  ['anteater', 'bit', 'cat', 'dog', 'mailman']
  ['anteater', 'bit', 'cat', 'dog', 'mailman']
  ['anteater', 'bit', 'cat', 'dog', 'mailman']
  ['anteater', 'bit', 'cat', 'dog', 'mailman']
  ['anteater', 'bit', 'cat', 'dog', 'mailman']
  </code></pre>