title: Reading text files into lists in Python
body: <p>Instead of defining <code>documents</code>like this ...</p>
  
  <pre><code>documents = ["the mayor of new york was there", "machine learning can be useful sometimes","new york mayor was present"]
  </code></pre>
  
  <p>... I want to read the same three sentences from two different txt files with the first sentence in the first file, and sentence 2 and 3 in the second file.</p>
  
  <p>I have come up with this code: </p>
  
  <pre><code># read txt documents
  os.chdir('text_data')
  documents = []
  for file in glob.glob("*.txt"): # read all txt files in working directory
      file_content = open(file, "r")
      lines = file_content.read().splitlines()
      for line in lines:
          documents.append(line)
  </code></pre>
  
  <p>But the <code>documents</code> resulting from the two strategies seem to be in different format. I want the second strategy to produce the same output as the first.</p>