title: How to read multiple text files in a folder with Python?
body: <p>I have looked at multiple questions &amp; answers across SO, as well as other platforms pertaining to reading text files in a folder, but unfortunately none seems to work for me at the moment. I have multiple text files in a folder and would like to read them all, and put each text file as a string into a new list <code>new_list</code>.</p>
  
  <pre><code>path = "MyNews_AccidentDataset/News_txt.txt"
  all_files = os.listdir(path)
  </code></pre>
  
  <p>Using this gives me <code>all_files</code> as a list with names of all text files</p>
  
  <pre><code> '0185_Man dies after 100ft turbine fall  .txt',
   '0131_Deaths_from_Working_with_Wind_Energy - Copy (5) - Copy.txt',
   '0001_BENDING_WITH_THE_WIND._Modern_Power_System_N.txt']
  .......
  </code></pre>
  
  <p>However, when I use <code>open()</code> to read the file, </p>
  
  <pre><code>new_list = []
      for fle in all_files:
         # open the file and then call .read() to get the text
         with open(fle) as f:
            text = f.read()
            new_list.append(text)
  </code></pre>
  
  <p>I get the following error:-</p>
  
  <pre><code>with open(fle) as f:
  FileNotFoundError: [Errno 2] No such file or directory: '0106_Car_vehicles_part_falls_on_the_roadway.txt'
  </code></pre>
  
  <p>although the mentioned file exists in the folder.</p>
  
  <p>Any help in this regard is appreciated.</p>
  
  <p><strong>EDIT</strong>
  Using complete path as in suggested comment by @bexi</p>
  
  <pre><code>for fle in all_files:
     # open the file and then call .read() to get the text
     with open(os.path.join(path, fle)) as f:
        text = f.read()
  </code></pre>