how to open many text files with python
<p>I have 800 text files about protein. Actually I should make a matrix 800 in 800 to compare interaction between proteins.  I entered their names in a list. Because writing all names in program is difficult. Now I want to open them in the python programming to use. But I don’t know what the program is to do it.</p>

<pre><code>import csv
from os import listdir
from os.path import isfile,join
Protein_List = [f for f in listdir("/home/rezvane/GENE6") if isfile(join("/home/rezvane/GENE6",f))]
Matrix_Interaction = [[]*7]
Number_of_Interaction = 0
for i in range(7):
    CC_Interaction = []
    fh = open("/home/rezvane/GENE6/O15209:ZBTB22.txt")
    test = False
    for line in fh.readline():
        if "CC   -!- INTERACTION" in line:
            test = True
        if "CC   -!- SUBCELLULAR LOCATION" in line:
            break
        if test:
            data = line.split(";")[0][9:]
            CC_Interaction.append(data)
    for j in range(7):
        if Protein_List[j] in CC_Interaction:
            Matrix_Interaction[i][j] = 1
            Number_of_Interaction +=1
        else:
            Matrix_Interaction[i][j] = 0
print Matrix_Interaction
print Number_of_Interaction
</code></pre>
