title: Python beautiful soup select text
body: <p>The following is an example of the HTML code I want to parse:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;td style="PADDING-LEFT:  5px"bgcolor="ffffff" class="style8"&gt; Example BLAB BLAB BLAB &lt;/td&gt;
  &lt;td style="PADDING-LEFT:  5px"bgcolor="ffffff" class="style8"&gt; BLAB BLAB BLAB &lt;/td&gt;
  &lt;td style="PADDING-LEFT:  5px"bgcolor="ffffff" class="style8"&gt; BLAB BLAB BLAB &lt;/td&gt;
  &lt;td style="PADDING-LEFT:  5px"bgcolor="ffffff" class="style8"&gt; BLAB BLAB BLAB &lt;/td&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am using beautiful soup to parse the HTML code by selecting style8 as follows (where html reads the result of my http request):</p>
  
  <pre><code>html = result.read()
  soup = BeautifulSoup(html)
  
  content = soup.select('.style8')
  </code></pre>
  
  <p>In this example, the <code>content</code> variable returns a list of 4 Tags. I want to check the <code>content.text</code>, which contains the text of each <code>style8</code> class, for each item in the list if it contains <code>Example</code> and appends that to a variable. If it proceeds through the entire list and <code>Example</code> does not occur within the list, it then appends <code>Not present</code> to the variable.</p>
  
  <p>I have got the following so far:</p>
  
  <pre><code>foo = []
  
  for i, tag in enumerate(content):
      if content[i].text == 'Example':
          foo.append('Example')
          break
      else:
          continue
  </code></pre>
  
  <p>This will only append <code>Example</code> to <code>foo</code> if it occurs, however it will not append <code>Not Present</code> if it does not occur within the entire list.</p>
  
  <p>Any method of doing so is appreciated, or better way of searching the entire results to check if a string is present would be great</p>