writing values generated from different functions in a single file
<p>I have written this code and what I am trying to do here is to write the values generated from this function and another one which are in stored as lists in <code>timeList</code> and
<code>parameterList</code>. I am not exactly supposed to write the values of <code>timeList</code> in the same function I guess. It should probably be done in a separate function. I have already got the <code>timeList</code> in <code>curve.dat</code> file. Now I have to write the <code>parameterList</code> in the same file but not following the values of <code>timeList</code> but on the right side of the <code>timeList</code>. The <code>timeList</code> in <code>curve.dat</code> file is:</p>

<blockquote>
  <p>0.07<br>
  0.06<br>
  0.08<br>
  0.12<br>
  0.11<br>
  0.09<br>
  0.14<br>
  0.05<br>
  0.06   </p>
</blockquote>

<p>The parameterList is:</p>

<p><code>[0.744527502029805, 1.3466145472841764, 2.8186875392157371, 3.2822440320192392, 7.9272007790523782, 6.0493081375991276, 9.2609232787439613, -611.06135600582172, -399.75236270058838]</code></p>

<p>Now I should have the contents of curve.dat file as the following:</p>

<pre>
0.07       0.744527502029805  
0.06       1.3466145472841764  
0.08       2.8186875392157371  
0.12       3.2822440320192392  
0.11       7.9272007790523782  
0.09       6.0493081375991276  
0.14       9.2609232787439613  
0.05       -611.06135600582172  
0.06       -399.75236270058838  
</pre>

<p>Could someone help with this please. Thank you.</p>

<pre><code>def time(transcriptionFile) :
    with open("transcriptions.txt", "r") as tFile :
        timeList = []
        parameterList = []

        for line in tFile :
            li = line.split()
            if li :
                start_time = (int(li[0]) / 10000000.)
                end_time = (int(li[1]) / 10000000.) 
                duration = ((int(li[1]) -int(li[0]))/10000000.)
                timeList.append(duration) # t(u) values for plotting the bezier curves

                with open("curve.dat", "w") as outFile:
                    outFile.write("\n".join(str(x) for x in timeList))

                poly = poly_coeff(start_time, end_time, duration)

                Newton(poly, 0.42, parameterList) 
</code></pre>
