title: Reordering the paragraphs in a text file using python
body: <p>I have a python code that produces the output text file in a word document. This output file is being produced in a for loop. The text file being produced is a summary text of an article. The output looks something like this:</p>
  <pre><code>Results:
  
  &lt;....summarized text.....
  ........................&gt;
  
  Methods:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Conclusions:
  
  &lt;.....summarized text....
  ........................&gt;
  
  Background:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Methods:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Results:
  
  &lt;....summarized text.....
  ........................&gt;
  
  
  Conclusions:
  
  &lt;.....summarized text....
  ........................&gt;
  
  Background:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  </code></pre>
  <p>Whereas I want the output text file in the following format:</p>
  <pre><code>Background:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Methods:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Results:
  
  &lt;....summarized text.....
  ........................&gt;
  
  Conclusions:
  
  &lt;.....summarized text....
  ........................&gt;
  
  Background:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Methods:
  
  &lt;.....summarized text.....
  .........................&gt;
  
  Results:
  
  &lt;....summarized text.....
  ........................&gt;
  
  Conclusions:
  
  &lt;.....summarized text....
  ........................&gt;
  
  </code></pre>
  <p>How can this be achieved using python?</p>