Skip to content

Commit

Permalink
construct original wordbase
Browse files Browse the repository at this point in the history
  • Loading branch information
lyhsieh committed Feb 8, 2022
1 parent 593959d commit b6ccece
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions construct.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
def alphabet(ch: str) -> bool:
return True if ord('a') <= ord(ch) <= ord('z') else False

fh = open('/usr/share/dict/words')
fh = open('/usr/share/dict/words', 'r')
fh2 = open('wordlist.txt', 'w')

five = []
for w in fh.readlines():
new_w = w[:-1] if w[-1] == '\n' else w
if len(new_w) == 5 and all([alphabet(ch) for ch in new_w]):
five.append(new_w)
fh2.write(new_w + '\n')

fh.close()
fh2.close()

0 comments on commit b6ccece

Please sign in to comment.