Reversing a column of text from a file in Python
<p>I am writing a program to reformat a text file. The old file contains a couple columns of text like below.</p>

<pre><code>Take
3
29
1001 83.489601 279.859650 1.000000
1002 83.489594 271.848480 0.997735
1003 83.489594 263.837311 0.997337
1004 83.489594 256.076111 0.996816
1005 83.364594 248.189941 0.995626
1006 83.364594 240.178787 0.994840   
</code></pre>

<p>My program currently writes this to a new file in a format that I want, and adds some lines. It then looks like this: </p>

<pre><code>clip
Values 12
trick, pos, ypos, similarity
1001 83.489601 279.859650 1.000000
1002 83.489594 271.848480 0.997735
1003 83.489594 263.837311 0.997337
1004 83.489594 256.076111 0.996816
1005 83.364594 248.189941 0.995626
1006 83.364594 240.178787 0.994840
</code></pre>

<p>What I need to do now is reverse the vertical order of the third column of numbers for the new file. It should end up looking like this:</p>

<pre><code>clip
Values 12
trick, pos, ypos, similarity
1001 83.489601 240.178787 1.000000
1002 83.489594 248.189941 0.997735
1003 83.489594 256.076111 0.997337
1004 83.489594 263.837311 0.996816
1005 83.364594 271.848480 0.995626
1006 83.364594 279.859650 0.994840
</code></pre>

<p>I can split out the third set of numbers one line at a time but can't figure out how I should go about writing that column back in to it's correct position. There are multiple blocks of this in the file and they vary in length. I just need a direction to start working in as I am completely lost right now. What kind of functions should I be looking at to help me accomplish this? Any help would be appreciated. I am new to coding and am using Python 3.2.2</p>
