title: How do I load specific rows from a .txt file in Python?
body: <p>Say I have a .txt file with many rows and columns of data and a list containing integer values. How would I load the row numbers in the text file which match the integers in the list?</p>
  
  <p>To illustrate, say I have a list of integers:</p>
  
  <pre><code>a = [1,3,5]
  </code></pre>
  
  <p>How would I read only rows 1,3 and 5 from a text file into an array?</p>
  
  <p>The loadtxt routine in numpy let's you both skip rows and use particular columns. But I can't seem to find a way to do something along the lines of (ignoring incorrect syntax):</p>
  
  <pre><code>new_array = np.loadtxt('data.txt', userows=a, unpack='true')
  </code></pre>
  
  <p>Thank you.</p>