title: How to strip newlines from each line during a file read?
body: <p>I'm reading lines from a file that contains one[*] word/line, such as:</p>
  
  <pre><code>dog
  cat
  person
  tree
  </code></pre>
  
  <p>Each of these words also contains a newline <code>\n</code> character. I want to read them into a list and throw away the newlines. The way I've devised is to read with <code>readlines()</code> and then process the list to <code>strip()</code> the newlines:</p>
  
  <pre><code>with open('words.txt') as f:
      words = f.readlines()
  
  for index, word in enumerate(words):
      words[index] = word.strip()
  </code></pre>
  
  <p>This works fine, but I can't help thinking there's a more efficient way to do this, to strip the newlines during the read process. But I can't find a way. Is there something more efficient (while also considering readability, etc.)</p>
  
  <p>[*] UPDATE: I should have mentioned that some lines may contain more than one word, and in those cases however many words are on a line should go into a single list item. Both answers so far handle this (as does my own code), but I wanted to mention it.</p>