Sequential output of files in python
<p>I wanted a method that would enable me to output files sequentially to a folder and give them a name that is stored in an array.</p>

<p>Here is the layout of the data:</p>

<pre><code>16837,144335,LOC516870
141961,198534,LOC100337147
223927,257577,LOC100849016
267259,273010,LOC512435
269335,277567,LOC100300061
</code></pre>

<p>I have read it in using:</p>

<pre><code>from numpy import *
x,y=genfromtxt('C:\\Users\\Mohammed\\Desktop\\positions1.txt', dtype=None, delimiter=',', usecols=[0,1],unpack=True)
z=genfromtxt('C:\\Users\\Mohammed\\Desktop\\positions1.txt', dtype='|S12', delimiter=',', usecols=[2],unpack=True)
exit
</code></pre>

<p>Now I want to construct a do loop that names the files with the variable z sequentially as </p>

<pre><code>LOC516870.txt 
LOC100337147.txt 
</code></pre>

<p>and so on.</p>

<p>I tried the following: </p>

<pre><code>for i in range (6):

 f = open("C:\\Users\\Mohammed\\Desktop\\Sequences\\'z'.txt", 'wt')

f.write(Seq)

f.close()
</code></pre>

<p>While I know a similar code would work in Perl, it didn't work in python and it says that its an invalid syntax!</p>

<p>Your help with this would be greatly appreciated.</p>

<p>Thank you!</p>
