I am trying to delete all blank lines in all YAML files in a folder. I have multiple lines with nothing but CRLF (using Notepad++), and I can't seem to eliminate these blank lines. I researched this before posting, as always, but I can't seem to get this working.
import glob
import re
path = 'C:\\Users\\ryans\\OneDrive\\Desktop\\output\\*.yaml'
for fname in glob.glob(path):
    with open(fname, 'r') as f:
        sfile = f.read()
        for line in sfile.splitlines(True):
            line = sfile.rstrip('\r\n')
            f = open(fname,'w')
            f.write(line)
            f.close()
Here is a view in Notepad++
I want to delete the very first row shown here, as well as all other blank rows. Thanks.

 
     
     
    