Python: load words from file into a set,words = set(open('filename.txt').read().split())