title: numpy - Python - Selectively import parts of the .txt file
body: <p>In my data.txt file, there are 2 types of lines.</p>
  
  <ol>
  <li><p>Normal data: 16 numbers separated by spaces with a '\n' appended at the end.</p></li>
  <li><p>Incomplete data: In the process of writing the data into data.txt, the writing-in of the last line is always interrupted by the STOP command. Thus, it is always incomplete, e.g.it can have 10 numbers and no '\n'</p></li>
  </ol>
  
  <p><strong>Two questions:</strong></p>
  
  <p><strong>a. How can I import the whole file EXCEPT the last incomplete line into Python?</strong> </p>
  
  <p>I notice that </p>
  
  <pre><code># Load the .txt file in
  myData = np.loadtxt('twenty_z_up.txt')
  </code></pre>
  
  <p>is quite "strict" in the sense that when the last incomplete line exists there, the file cannot be imported. The imported .txt file has to be a nice matrix.</p>
  
  <p><strong>b.</strong> Occasionally, I make timestamps on the first entry of a line for experiment purpose. Say I have my 1st timestamp at the start of line 2, and my 2nd stamp at the start of line 5. <strong>How can I import only from line 2 to line 5 into Python?</strong></p>
  
  <p>=============================== Updates: Q.a is solved ================================</p>
  
  <pre><code>myData = np.genfromtxt('fast_walking_pocket.txt', skip_footer=1)
  </code></pre>
  
  <p>will help discard the final incomplete row</p>