title: I need to edit a text file with a non-constant structure. Trying to use pandas, is this the best tool for the job?
body: <p>I am trying to change a textfile but this will have to be done a lot so I thought I would use the chance to learn how to use python to edit text files.</p>
  
  <p>The text file I have looks something like this:</p>
  
  <pre><code>title1
  title2
  ...
  title5
  var1 var2 var3 var4 var5
  var1.1 var2.1 var3.1 var4.1 var5.1
  </code></pre>
  
  <p>So on and so forth. The titles can extend to be anywhere from 5 to 18 and the number of titles = the number of columns for the rows with the variables. </p>
  
  <p>The variable rows can get into the hundreds of thousands.</p>
  
  <p>I need to basically add a single title (constant) and then onto every row I need to add an extra column that is dependent on a number somewhere in var1 (a string) of that row.</p>
  
  <p>Is pandas the correct thing to be using here? Currently when I just import it using read_table it doesn't like the addition of delimiter information I assume because the initial rows are just a single thing. </p>
  
  <p>All advice would be much appreciated.</p>
  
  <p>Many thanks</p>