Writing data to text file then changing half way
<p>I am trying to write data into next file but then half way down, change one value of the column going forward that has is constant for the first set of lines. This is my code:</p>

<pre><code>import random
import time

start_time = time.time() #time measurement
numpoints = 512
L = 20
d = 1
points = set()

# Open f and write
with open("question2.xyz","w") as f:
    f.write("%d\ncomment goes here\n" % numpoints) #this is for the 2nd line in my xyz 
    while len(points) &lt; numpoints:
        p = (random.randint(0, L), random.randint(0, L), random.randint(0, L))
        if p not in points:
            points.add(p)
            f.write('H %f %f %f\n' % p)
</code></pre>

<p>My code currently produces an XYZ file in this format</p>

<pre><code>512 #number of
comment goes here
H 6.000000 19.000000 14.000000
H 11.000000 2.000000 7.000000
H 15.000000 20.000000 16.000000
</code></pre>

<p>Thanks for the help in advance!</p>

<p>Edit, woops sorry, this is what I want to achieve</p>

<pre><code>512 #number of
comment goes here
H 6.000000 19.000000 14.000000
H 11.000000 2.000000 7.000000
H 15.000000 20.000000 16.000000
O 6.000000 19.000000 14.000000
O 11.000000 2.000000 7.000000
O 15.000000 20.000000 16.000000
</code></pre>

<p>Right now my code puts in H for the first value for all 512 lines, starting in line 256, I need that changed to an O</p>
