kkhhhkk
Coder
I have the following code that writes out multiple files. I want this code to also write out an empty line at the end of each file produced, I've tried adding ('\n\') inside the loop however it adds an empty line to every line which is annoying
Python:
i = 0
f = open('innput.txt','r')
always_print = False
with f as fp:
lines = fp.readlines()
for line in lines:
if ' X ' in line:
i += 1
ff = open('dipole_'+str(i)+'.com','a')
ff.write('Header')
always_print = True
elif always_print:
ff.write(line)
ff.write('\n\n')
else:
pass
if always_print:
continue