Accessing directories and files using python
<p>I want to analyze my data by a python script. The data are in multiple file and they are kept in different directories. Moreover, the name of the files in those directories are same but have different extension. I want to get my output just by providing a single input filename. for example</p>

<p>my filename is 'test' and this will be my input </p>

<p>the actual filenames are suppose test.data1, test.data2, test.data3, test.data4 and among them two input files such as test1.data1 and test2.data2 are kept in test1, test2 directories. The test3 and test4 are output directories.My aim is access those directories through the python script and then access those datafile. All the four directories are present in my machine but the two output files will be generated with extension .data3 and .data4 through the script. I have started with this following script but I can't complete it. Any help will be appreciating </p>

<pre><code>import re
import numpy
import os
import glob
filename =raw_input('enter the input file name: ')
lines = open(input.data1, 'r').readlines()
lines1 = open(input.data2, 'r').readlines()
outfile1=open(input.data3, 'w')
outfile2=open(input.data4, 'w')
</code></pre>

<p>Best
Sudipta</p>
