title: How to get print the content of tags in order in beautifulsoup?
body: <p>I am trying to get the text from an html page posted below. I tried for loops but it does not print the strings in order. I need to print the strings in order like:</p>
  
  <pre><code>            text1:text_1.1
              text2:text2.2,2.2
              ...
  </code></pre>
  
  <p>I need to get the output printed above.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;ul&gt; 
     &lt;li&gt;
      &lt;b&gt;text1:&lt;/b&gt;
      &lt;a&gt;&lt;a href="search.php?origin="&gt;text_1.1&lt;/a&gt;
      &lt;/li&gt;
     &lt;li&gt;
      &lt;b&gt;text2&lt;/b&gt;
      &lt;a href="search.php?origin="&gt;text_2.1&lt;/a&gt;
      &lt;a href="search.php?origin"&gt;text_2.2&lt;/a&gt;
     &lt;/li&gt;
     &lt;li&gt;
      &lt;b&gt;text4&lt;/b&gt;
      &lt;a href="search.php?origin="&gt;text_4.1&lt;/a&gt;
      &lt;a href="search.php?origin="&gt;text_4.2&lt;/a&gt;
      &lt;a href="search.php?origin="&gt;text_4.3&lt;/a&gt;
      &lt;a href="search.php?origin="&gt;text_4.4&lt;/a&gt;
     &lt;/li&gt;
     &lt;li&gt;
      &lt;b&gt;text5&lt;/b&gt;
       &lt;a href="search.php?origin="&gt;text5.1&lt;/a&gt;
     &lt;/li&gt;
      &lt;li&gt;
      &lt;b&gt;text6&lt;/b&gt;
      &lt;a href="search.php?origin="&gt;text6.1&lt;/a&gt;
      &lt;a href="search.php?origin="&gt;text6.2&lt;/a&gt;
      &lt;a href="search.php?origin="&gt;text6.3&lt;/a&gt;
     &lt;li&gt;
      &lt;b&gt;text7&lt;/b&gt;
      &lt;a href="search.php?origin="&gt;text7.1&lt;/a&gt;
      &lt;font color="green"&gt;text7.2&lt;/font&gt;          
      &lt;/li&gt;
     &lt;li&gt;
      &lt;b&gt;text8&lt;/b&gt;
      &lt;a href="dwres.php?resource="&gt;2 &lt;/a&gt;
    &lt;/ul&gt;
  </code></pre>