title: BeautifulSoup find two different strings
body: <p>I'm currently using Selenium and Beautiful soup to grab all the HTML data from a website. Currently all the data is stored in a variable in Python.</p>
  
  <pre><code>soup = BeautifulSoup(driver.page_source, 'lxml')
  </code></pre>
  
  <p>What is the best way to look for the occurrence of two different words, either exactly "Open" or exactly "Closed" and print them to the console in the order that they are found.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>for node in soup.find_all(text=lambda x: x and "Open" in x):
  print(node)
  </code></pre>
  
  <p>But how would I also get it to search for exactly "Closed"</p>
  
  <p><strong>Updated code I have:</strong></p>
  
  <pre><code>soup = BeautifulSoup(driver.page_source, 'lxml')
  
  status = soup.find('div', attrs={"class":"pagebodydiv"})
  
  with open("status.txt", "w") as file:
      for node in status.find_all(text=lambda t: t in ('Open', 'Closed')):
          file.write(node.encode("utf-8")+"\n")
  </code></pre>