title: Write a line above the current line in a file Python
body: <p>I am looping through a file and I need to insert a text block above a line when it matches a particular string. Please help!</p>
  
  <pre><code> convBlockMoved = False
   for line in outfile:
      if(line.startswith('mappingSchemeAxis') and not convBlockMoved):
         for convLine in conversionBlocks:
              print convLine, #Print this above line
              convBlockMoved = True
  </code></pre>
  
  <p>Note: conversionBlocks is a String array</p>