title: Trying to print out only "state failed" but Python is printing everything
body: <p>I am looping through the HTML content of a web page and trying to print only strings with the substring "state failed".  However, Python is printing every single string, even the ones that don't have the substring "state failed".  </p>
  
  <p>Here is my code:</p>
  
  <pre><code>soup = bs(html_page, 'lxml')
  outF = open('C:/Users/ryans/OneDrive/Desktop/test.csv', 'w')
  for link in soup.findAll('rect'):
      if "state failed" in link:
          if link.isoweekday() in range(1, 6):
              outF.write(str(link))
              outF.write('\n')   
  outF.close()
  </code></pre>
  
  <p>Here is one that I would expect to be printed, and it is.</p>
  
  <pre><code>&lt;rect class="state failed" data-original-title="Task_id: failure_cleanup&amp;lt;br&amp;gt;Run: 2018-12-22T04:00:00&amp;lt;br&amp;gt;Operator: CruxCleanupOperator&amp;lt;br&amp;gt;Started: 2018-12-24T18:34:39.149434&amp;lt;br&amp;gt;Ended: 2018-12-24T18:34:45.935977&amp;lt;br&amp;gt;Duration: 6.78654&amp;lt;br&amp;gt;State: failed&amp;lt;br&amp;gt;" data-toggle="tooltip" height="10" rx="0" ry="0" style="shape-rendering: crispedges; stroke-width: 1; stroke-opacity: 1;" title="" width="10" x="984" y="-5"&gt;&lt;/rect&gt;
  </code></pre>
  
  <p>Here is one that I would expect NOT to be printed, but form some odd reason it is being printed.</p>
  
  <pre><code>&lt;rect class="state success" data-original-title="Task_id: join_cleanup&amp;lt;br&amp;gt;Run: 2018-12-22T04:00:00&amp;lt;br&amp;gt;Operator: CompletionBranchOperator&amp;lt;br&amp;gt;Started: 2018-12-24T18:33:30.834983&amp;lt;br&amp;gt;Ended: 2018-12-24T18:33:33.037330&amp;lt;br&amp;gt;Duration: 2.20235&amp;lt;br&amp;gt;State: success&amp;lt;br&amp;gt;" data-toggle="tooltip" height="10" rx="0" ry="0" style="shape-rendering: crispedges; stroke-width: 1; stroke-opacity: 1;" title="" width="10" x="984" y="-5"&gt;&lt;/rect&gt;
  </code></pre>
  
  <p>I tied all combinations with the single quotes, double, and even triple.  It dodesn't matter.  It prints everything, even the strings that don't contain "State failed".  Any idea what's wrong here?  Thanks.</p>