title: Fastest way to determine if two strings differ by a single letter in a large set of strings
body: <p>I am trying to compare two strings and add one of the strings to a list if they are almost equal (differ by a single letter). What would be the fastest way to do this as my set of words is over 90k and doing this often takes too long?</p>
  
  <p>EDIT: one of the words (comparison_word in code below) does not change.</p>
  
  <p>EDIT2: the words must be of equal length</p>
  
  <p>This is my current code:</p>
  
  <pre><code>    for word in set_of_words:
          amount = 0  
          if len(word) == len(comparison_word):
              for i in range(len(word)):
                  if comparison_word[i] != word[i]:
                      amount += 1
              if amount == 1:
                  list_of_words.append(word)
      return list_of_words
  </code></pre>