Python code for finding word paird with common L

a guest Sep 27th, 2015 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. myF = open("wordsEn.txt")
  2. myWords = []
  3. for w in myF:
  4.     myWords.append(w.strip())
  5. myF.close()
  7. myF = open("wordResults1.txt","w")
  8. for w in myWords:
  9.     if w.count('l')>=1:
  10.         for i,letter in enumerate(w):
  11.             if letter=="l":
  12.                 w2 = w[:i]+w[i+1:]
  13.                 if w2 in myWords:
  14.                     myF.write("%s,%s\n"%(w,w2))
  16. myF.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand