I would recommend the editdistance Python package, which provides an editdistance.eval
function that calculates the number of characters you need to change to get from the first word to the second word. Edit distance is the same as Levenshtein distance, which was suggested by MattDMo.
In your case, if you want to identify words within 1 edit distance of each other, you could do:
import editdistance as ed
thresh = 1
w1 = "work"
word_set = set(["word","look","wrap","pork"])
neighboring_words = [w2 for w2 in word_set if ed.eval(w1, w2) <= thresh]
print neighboring_words
with neighboring_words
evaluating to ['pork', 'word']
.