title: Python merge multiple txt files
body: <p>I tried to merge multiple TXT-files in a folder with this code but it is not working:</p>
  
  <pre><code>import os,shutil
  path = "C:/Users/user/Documents/MergeFolder"
  f=open(path + "/fileappend.txt","a")
  for r,d,fi in os.walk(path):
       for files in fi:
           if files.endswith(".txt"):                         
                g=open(os.path.join(r,files))
                shutil.copyfileobj(g,f)
                g.close()
  f.close()
  </code></pre>
  
  <p>Anyone has an idea?</p>