Experiments with Knuth's 5,757 five letter words. https://charlesreid1.com/wiki/Five_Letter_Words

get_words.py 376B

1234567891011121314151617181920
  1. """
  2. get_words.py
  3. Utility method to load the SBG words
  4. and retun them as a list of strings.
  5. """
  6. def get_words():
  7. # Load the file.
  8. with open('sgb-words.txt','r') as f:
  9. ## This includes \n at the end of each line:
  10. #words = f.readlines()
  11. # This drops the \n at the end of each line:
  12. words = f.read().splitlines()
  13. return words