From b6ccececa31eaab64c39a57a9deef8f65e335670 Mon Sep 17 00:00:00 2001 From: leothebestcoder Date: Tue, 8 Feb 2022 10:59:58 +0800 Subject: [PATCH] construct original wordbase --- construct.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/construct.py b/construct.py index dc74df8..ec40992 100644 --- a/construct.py +++ b/construct.py @@ -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()