Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement