with open('test.txt', 'r') as fh:
    output = []
for ii, line in enumerate(fh):
    if ii not in (1, 3):
        output.append(line)
with open('test.txt', 'w') as fh:
    fh.writelines(output)
How do I save the header and units of an astropy Table into an ascii file