I have a code that takes a file and splits the file into two files. The problem I am having is when writing the lower half of the file I have two lines of whitespace I need removed. Here is what I have and am wonder how I could add a line of code to remove the extra lines.
Files=glob.glob('/home/mypathname/*.TAB')
output= ('/home/mypathname/')
for (count, aFileName) in enumerate(files):
filename = aFileName.split('/')[11]
day=aFileName.split('/')[10]
print day
print filename
F=open(aFileName, 'r')#.readlines()
_,keep=F.read().split('END ',1)
#keep,_=F.read().split('END ',1)
print keep
new=open(output+('/')+day+('/')+filename+('test'), 'w')
for line in keep:
new.write(line)
#new.write("END")
new.close()