From 2b90d9a495c4ebf477926a70a194dc0f4d7a9683 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Fri, 28 Jun 2024 09:37:28 -0400 Subject: [PATCH] With open, not open --- thesethreewords.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/thesethreewords.py b/thesethreewords.py index a398d6c..357423d 100644 --- a/thesethreewords.py +++ b/thesethreewords.py @@ -9,12 +9,10 @@ import geohash def get_words(fname): - lines = open(fname) - words = [] - for word in lines: - words.append(word.strip()) - - lines.close() + with open(fname) as lines : + words = [] + for word in lines: + words.append(word.strip()) random.seed(634634) random.shuffle(words) words = words[:2**15]