title: Python: scrape a part of source code and save it as html
body: <p>Here is the case, I need to save a web page's source code as html file. But if you look at the web page, there are lots of section, I don't need them, I only want to save the source code of the article itself.</p>
  
  <p>code:</p>
  
  <pre><code>from urllib.request import urlopen
  
  page = urlopen('http://www.abcde.com')
  page_content = page.read()
  
  with open('page_content.html', 'wb') as f:
      f.write(page_content)
  </code></pre>
  
  <p>I can save the whole source code from my code, but how can I just save the only part I want? </p>
  
  <p>Explain:</p>
  
  <pre><code>&lt;div itemscope itemtype="http://schema.org/MedicalWebPage"&gt;
  .
  .
  .
  &lt;/div&gt;
  </code></pre>
  
  <p>I need to save the source code with and inside this tag , not extract the sentences in the tags.</p>
  
  <p>The result I want is to save like this:</p>
  
  <pre><code>&lt;div itemscope itemtype="http://schema.org/MedicalWebPage"&gt;
  
                      &lt;div class="col-md-12 col-xs-12" style="padding-left:10px;"&gt;
                          &lt;h1 itemprop="name" class="page_article_title" title="Apple" id="mask"&gt;Apple&lt;/h1&gt;
                      &lt;/div&gt;
                      &lt;!--Article Start--&gt;
                      &lt;section class="page_article_div" id="print"&gt;
                          &lt;article itemprop="text" class="page_article_content"&gt;
  &lt;p&gt;
      &lt;img alt="Apple" src="http://www.abcde.com/383741719.jpg" style="width: 300px; height: 200px;" /&gt;&lt;/p&gt;
  &lt;p&gt;
      The apple tree (Malus pumila, commonly and erroneously called Malus domestica) is a deciduous tree in the rose family best known for its sweet, pomaceous fruit, the apple.&lt;/p&gt;
  &lt;p&gt;
      It is cultivated worldwide as a fruit tree, and is the most widely grown species in the genus Malus.&lt;/p&gt;
  &lt;p&gt;
      &lt;strong&gt;&lt;span style="color: #884499;"&gt;Appe is red&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
  &lt;ol&gt;
      &lt;li&gt;
          Germanic paganism&lt;/li&gt;
      &lt;li&gt;
          Greek mythology&lt;/li&gt;
  &lt;/ol&gt;
  &lt;p style="text-align: right;"&gt;
      【Jane】&lt;/p&gt;
  &lt;p style="text-align: right;"&gt;
      Credit : Wiki&lt;/p&gt;
  
                          &lt;/article&gt;
                              &lt;div style="text-align:right;font-size:1.2em;"&gt;&lt;a class="authorlink" href="http://www.abcde.com/web/online;url=http://61.66.117.1234/name=2017"&gt;2017&lt;/a&gt;&lt;/div&gt;
                          &lt;br /&gt;                  
                          &lt;div style="text-align:right;font-size:1.2em;"&gt;【Thank you!】&lt;/div&gt;
                      &lt;/section&gt;
                      &lt;!--Article End--&gt;
  &lt;/div&gt;
  </code></pre>