title: Remove trailing newline from the elements of a string list
body: <p>I have to take a large list of words in the form:</p>
  
  <pre><code>['this\n', 'is\n', 'a\n', 'list\n', 'of\n', 'words\n']
  </code></pre>
  
  <p>and then using the strip function, turn it into:</p>
  
  <pre><code>['this', 'is', 'a', 'list', 'of', 'words']
  </code></pre>
  
  <p>I thought that what I had written would work, but I keep getting an error saying:</p>
  
  <blockquote>
    <p>"'list' object has no attribute 'strip'"</p>
  </blockquote>
  
  <p>Here is the code that I tried:</p>
  
  <pre><code>strip_list = []
  for lengths in range(1,20):
      strip_list.append(0) #longest word in the text file is 20 characters long
  for a in lines:
      strip_list.append(lines[a].strip())
  </code></pre>