title: Python: Creating a file list from a directory of .txt files
body: <p>I'm trying to load a corpus from a directory of .txt files then create a document list.</p>
  
  <p>I thought it would be simple enough, but when I run it nothing happens, am I missing something?</p>
  
  <pre><code>import os.path
  import re
  import glob
  
   def load_data_from_dir(path):
  file_list = glob.glob('/transcripts/*.txt')
  
  
  # create document list:
  documents_list = []
  for filename in file_list:
      with open(filename, 'r', encoding='utf8') as f:
          text = f.read()
          f.close()
          documents_list.append(text)
  print("Total Number of Documents:",len(documents_list))
  return documents_list
  </code></pre>