title: Extract Colored Text from Table with BeautifulSoup
body: <p>I am new to Python and fairly new to programming in general. I'm trying to work out a script that uses BeautifulSoup to parse <a href="https://www.state.nj.us/mvc/" rel="nofollow noreferrer">https://www.state.nj.us/mvc/</a> for any text that's red. The table I'm looking at is relatively simple HTML:</p>
  <pre><code>&lt;html&gt;
   &lt;body&gt;
    &lt;div class=&quot;alert alert-warning alert-dismissable&quot; role=&quot;alert&quot;&gt;
     &lt;div class=&quot;table-responsive&quot;&gt;
      &lt;table class=&quot;table table-sm&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
       &lt;tbody&gt;
        &lt;tr&gt;
         &lt;td width=&quot;24%&quot;&gt;
          &lt;strong&gt;
           &lt;font color=&quot;red&quot;&gt;Bakers Basin&lt;/font&gt;
          &lt;/strong&gt;
         &lt;/td&gt;
         &lt;td width=&quot;24%&quot;&gt;
          &lt;strong&gt;Oakland&lt;/strong&gt;
         &lt;/td&gt;
   ...
   ...
   ...
        &lt;/tr&gt;
       &lt;/tbody&gt;
      &lt;/table&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>From the above I want to find Bakers Basin, but not Oakland, for example.</p>
  <p>Here's the Python I've written (adapted from Cory Althoff <em>The Self-Taught Programmer</em>, 2017, Triangle Connection LCC):</p>
  <pre><code>import urllib.request
  from bs4 import BeautifulSoup
  
  
  class Scraper:
      def __init__(self, site):
          self.site = site
  
      def scrape(self):
          r = urllib.request.urlopen(self.site)
          html = r.read()
          parser = &quot;html.parser&quot;
          soup = BeautifulSoup(html, parser)
          tabledmv = soup.find_all(&quot;font color=\&quot;red\&quot;&quot;)
          for tag in tabledmv:
              print(&quot;\n&quot; + tabledmv.get_text())
  
  
  website = &quot;https://www.state.nj.us/mvc/&quot;
  Scraper(website).scrape()
  </code></pre>
  <p>I seem to be missing something here though because I can't seem to get this to scrape through the table and return anything useful. The end result is I want to add the time module and run this every X minutes, then to have it log a message somewhere for when each site goes red. (This is all so my wife can figure out the least crowded DMV to go to in New Jersey!).</p>
  <p>Any help or guidance is much appreciated on getting the BeautifulSoup bit working.</p>