I'm not particularly experienced with python, so may be doing something silly below. I have the following program:
import os
import re
import linecache
LINENUMBER = 2
angles_file = open("d:/UserData/Robin Wilson/AlteredData/ncaveo/16-June/scan1_high/000/angles.txt")
lines = angles_file.readlines()
for line in lines:
splitted_line = line.split(";")
DN = float(linecache.getline(splitted_line[0], LINENUMBER))
Zenith = splitted_line[2]
output_file = open("d:/UserData/Robin Wilson/AlteredData/ncaveo/16-June/scan1_high/000/DNandZenith.txt", "a")
output_file.write("0\t" + str(DN) + "\t" + Zenith + "\n")
#print >> output_file, str(DN) + "\t" + Zenith
#print DN, Zenith
output_file.close()
When I look at the output to the file I get the following:
0 105.5 0.0
0 104.125 18.0
0 104.0 36.0
0 104.625 54.0
0 104.25 72.0
0 104.0 90.0
0 104.75 108.0
0 104.125 126.0
0 104.875 144.0
0 104.375 162.0
0 104.125 180.0
Which is the right numbers, it just has blank lines between each line. I've tried and tried to remove them, but I can't seem to. What am I doing wrong?
Robin