title: Selecting certain rows from a set of data files in Python
body: <p>I am trying to manipulate some data with Python, but having quite a bit of difficulty (given that I'm still a rookie). I have taken some code from other questions/sites but still can't quite get what I want.</p>
  
  <p>Basically what I need is to take a set of data files and select the data from 1 particular row of each of those files, then put it into a new file so I can plot it.</p>
  
  <p>So, to get the data into Python in the first place I'm trying to use:</p>
  
  <pre><code>data = []
  path = C:/path/to/file
  for files in glob.glob(os.path.join(path, ‘*.*’)):
    data.append(list(numpy.loadtxt(files, skiprows=34))) #first 34 rows aren't used
  </code></pre>
  
  <p>This has worked great for me once before, but for some reason it won't work now. Any possible reasons why that might be the case?</p>
  
  <p>Anyway, carrying on, this should give me a 2D list containing all the data.</p>
  
  <p>Next I want to select a certain row from each data set, and can do so using:</p>
  
  <pre><code>x = list(xrange(30)) #since there are 30 files
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>rowdata = list(data[i][some particular row] for i in x)
  </code></pre>
  
  <p>Which gives me a list containing the value for that particular row from each imported file. This part seems to work quite nicely.</p>
  
  <p>Lastly, I want to write this to a file. I have been trying:</p>
  
  <pre><code>f = open('path/to/file', 'w')
     for item in rowdata:
        f.write(item)
  f.close()
  </code></pre>
  
  <p>But I keep getting an error. Is there another method of approach here?</p>