title: How to make an exact keyword search function in python 3
body: <p>I'm creating a program that generates random strings, puts them into a list, and runs those strings through a for loop that is supposed to search through a file to check if they are real words or not. The loop is like this:</p>
  
  <pre><code>wordvalidator = open("englishwords.txt", "r")
  for line in wordvalidator:
      for item in stringslist:
          if item in line:
              words.append(item)
  </code></pre>
  
  <p>"englishwords.txt" being the file with a multitude of words in it meant to validate the random strings that as actual words, "stringslist" being the list with the strings obviously, and "words" being the list the strings that have been verified to be real words will belong to. The problem is, that if for example there is one string, let's say "ird", which is not a real word, it will search through all the words and match it up with "bird". This is a problem because I don't know how to truly verify if these strings are words now. I don't know what to do, except for maybe replacing "if item in line" with "if item is line", which would modify the conditional to only be true if the string was exactly correspondent to the line in the document, but I don't know if "is" is an actual python term, I also don't know what else I could use similarly. Any help would be appreciated. Thanks.</p>