I only have very basic knowledge of python and the following problem:

I have a number of numbered text files *RA512\_mono\_1\_M2\_Ci\_lex.stat* for i in [1..n].
All these files have the same format with lines such as 

> 
> Number of apples in sample: x
> 
> 
> 

(The line is always the same in every file, only x is different)

I would like to write a program that reads all n of these files and gives an output text file of the form

> 
> [(1,x1),(2,x2),...,(n,xn)]
> 
> 
> 

so that I can plot them.

I have a few problems, that I haven't figured out yet:

1. How do I read a value at a certain position in the input file
2. How do I loop over the counter in the filenames

What I have so far is not much:

```
graphdata = []
for i in range(1,n):
    with open('RA512_mono_1_M2_Ci_lex.stat') as file_in: #What is the correct syntax for looping over i?
        datapoint = #How do I pick the value I want?
            graphdata.append(datapoint)

np.savetxt('graph.out', graphdata, delimiter=',') #There might be a better way without numpy?

```

Of course, there is more syntax to be fixed.