title: find text from visible HTML in python
body: <p>i'm trying to do the following:</p>
  
  <ol>
  <li>i have a text file that have some values line by line.</li>
  <li>a website that generate list of values based on the page number. the values are XXX &amp; YYY in the example below.</li>
  <li>python script reads the first text file (efficient 0(1) lookups using a set) and search in the website page after page by +1, and if a value match found it must print the page number.</li>
  </ol>
  
  <p>the search must be like www.site.com/1 www.site.com/2 www.site.com/3 ...etc</p>
  
  <p>HTML source:</p>
  
  <pre><code>&lt;pre class="values"&gt;
      &lt;strong&gt;A&lt;/strong&gt;
      &lt;strong&gt;B&lt;/strong&gt;
      &lt;strong&gt;C&lt;/strong&gt;
      &lt;span id="1"&gt;
          &lt;a href="/#"&gt;+&lt;/a&gt; 
          &lt;span title="1"&gt;1&lt;/span&gt;
          &lt;a href="/#"&gt;XXX&lt;/a&gt;
          &lt;a href="/#"&gt;YYY&lt;/a&gt;
      &lt;/span&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>text file efficient 0(1) lookups using a set:</p>
  
  <pre><code>with open("values.txt", "r") as f1:
          lines = set(f1) # efficient 0(1) lookups using a set
          for line in HTML :
              if line in lines:
                  print(line)
  </code></pre>