converting file from .txt to .csv doesn't write last column of data
<p>I have a text file that I'm trying to convert to a .csv file and have all the data separated into columns at every instance where there is white space between characters. The following code is doing this however it isn't writing the last column of data.</p>

<pre><code>txt_file = r'ATF_160A_AR-160B_Pr_Temp_test.txt'
data = []
with open(txt_file) as f:
    for line in f:
        data.append([word for word in line.split(' ') if word])


csv_file = r'ATF_160A_AR-160B_Pr_Temp_test.csv'
out_csv = csv.writer(open(csv_file, 'wb'))


out_csv.writerows(data)
</code></pre>

<p>The text file looks like this.</p>

<pre><code>odbName stepName instanceName  setName tmax_F tmax_C xcoord
abcd-1_AB.odb Nominal SPECIMEN_POS1-1 SET-1 789.345 420.747 0.0
abcd-1_AB.odb Nominal SPECIMEN_POS1-1 SET-1 751.559 399.755 0.1244
abcd-1_AB.odb Nominal SPECIMEN_POS1-1 SET-1 789.300 420.722 0.004976
abcd-1_AB.odb Nominal SPECIMEN_POS1-1 SET-1 789.193 420.663 0.009952
abcd-1_AB.odb Nominal SPECIMEN_POS1-1 SET-1 789.017 420.565 0.014928
abcd-1_AB.odb Nominal SPECIMEN_POS1-1 SET-1 788.770 420.428 0.019904
</code></pre>