title: Splitting multiple lined text file into a single list?
body: <p>I need some help figuring out how to split the words in a text file into a list. I can use something like this:</p>
  
  <pre><code>words = []
  for line in open('text.txt'):
      line.split()
      words.append(line)
  </code></pre>
  
  <p>But if the file contains multiple lines of text, they are split into sublists, e.g.</p>
  
  <pre><code>this is the first line
  this is the second line
  </code></pre>
  
  <p>Becomes:</p>
  
  <pre><code>[['this', 'is', 'the', 'first', 'line'], ['this', 'is', 'the', 'second', 'line']]
  </code></pre>
  
  <p>How do I make it so that they are in the same list? i.e.</p>
  
  <pre><code>[['this', 'is', 'the', 'first', 'line', 'this', 'is', 'the', 'second', 'line']]
  </code></pre>
  
  <p>thanks!</p>
  
  <p>EDIT:
  This program will be opening multiple text files, so the words in each file need to be added to a sublist. So if a file has multiple lines, all the words from these lines should be stored together in a sublist.
  i.e. Each new file starts a new sublist.</p>