title: What exactly is a navigablestring (HTML)?
body: <p>I'm currently trying to scrape text from webpages using Python 2.7's BeautifulSoup (bs4). My original code is as follows:</p>
  <pre><code>string = ''
  a = soup.find('div',attrs={&quot;id&quot;:&quot;pressrelease&quot;})
  [x.extract() for x in a.findAll('script')]
  [x.extract() for x in a.findAll(&quot;span&quot;, {'class':'hidden'})]
      
  for element in a:
       try:
           string += element.get_text()
          
       except Exception as e: print(e)
  </code></pre>
  <p>Although my code does get me the desired text, it also spits out the following error: <strong>'NavigableString' object has no attribute 'get_text'</strong>. I want to implement a feature that saves the URL if the code hits an exception but in this case, I don't want the URL saved since even though it's throwing an exception the page was successfully scraped. Thus, I am trying to better understand what the error exactly is (so I can decide whether to purposefully ignore this case).</p>
  <p>Any explanations on what a navigablestring is and why it would cause my code to throw such an error would be much appreciated!</p>