title: Write String after every line in every file of a folder
body: <p>I am new to Python and want to add a text line after every line of all files (only in specified file extensions) in a root folder and all subfolders with a Python script.
  What I collected from the internet:</p>
  
  <pre><code>import os
  import fnmatch
  
  for root, dirs, files in os.walk("dir"):
      for filename in files:
          if filename.endswith(".x",".y"):
              with open(filename, "r") as f:
                  file_lines = [''.join([x.strip(), "some_string", '\n']) for x in f.readlines()]
              with open(filename, "w") as f:
                  f.writelines(file_lines) 
  </code></pre>
  
  <p>I tested it with a small folder but get the error:
  IOError: [Errno 2] No such file or directory</p>