SHARE
TWEET

Untitled

a guest Jul 19th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from itertools import chain
  2.  
  3. dictionary=open("Scrabble.txt").read().split('n')
  4.  
  5. import re,string
  6.  
  7. #after replacing the word with "_", we find words in the dictionary that match the pattern
  8. def wordshape(word):
  9.     new=[]
  10.     for letter in string.ascii_lowercase:
  11.         underscore=re.sub('_', letter, word)
  12.         if underscore in dictionary:
  13.             new.append(underscore)
  14.     if new == []:
  15.         pass
  16.     else:
  17.         return new
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
 
Top