title: Reading source page saved in a text file and extracting text
body: <p>I have a multiple text files which have been used to store source pages from a website. So each text file is a source page.</p>
  
  <p>I need to extract text from a div class stored in the text file using the following code:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  soup = BeautifulSoup(open("zing.internet.accelerator.plus.txt"))
  txt = soup.find('div' , attrs = { 'class' : 'id-app-orig-desc' }).text
  print txt
  </code></pre>
  
  <p>I have checked type of my soup object to make sure It is not using string find method while looking for the div class. 
  Type of soup object</p>
  
  <pre><code>print type(soup)
  &lt;class 'bs4.BeautifulSoup'&gt;
  </code></pre>
  
  <p>I have already taken reference from one of <a href="https://stackoverflow.com/questions/21570780/using-python-and-beautifulsoup-saved-webpage-source-codes-into-a-local-file">the previous post</a>, and written open statement inside beautifulsoup statement.</p>
  
  <p>Error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "html_desc_cleaning.py", line 13, in &lt;module&gt;
      txt2 = soup.find('div' , attrs = { 'class' : 'id-app-orig-desc' }).text
  AttributeError: 'NoneType' object has no attribute 'text'
  </code></pre>
  
  <p>Source from the page:</p>
  
  <p><a href="https://i.stack.imgur.com/O04ma.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O04ma.png" alt="enter image description here"></a></p>