From 9a7f21e3c0aa7b16c2549087f0b85197985831e8 Mon Sep 17 00:00:00 2001 From: Kamyar Dabiri Date: Tue, 2 Feb 2021 22:54:16 -0800 Subject: [PATCH] fixed the end of line bug --- 09-kick-forward/tf-09.py | 2 +- 10-the-one/tf-10.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/09-kick-forward/tf-09.py b/09-kick-forward/tf-09.py index b07fe70..6d2ccd8 100755 --- a/09-kick-forward/tf-09.py +++ b/09-kick-forward/tf-09.py @@ -21,7 +21,7 @@ def scan(str_data, func): def remove_stop_words(word_list, func): with open('../stop_words.txt') as f: - stop_words = f.read().split(',') + stop_words = f.read().strip('\n').split(',') # add single-letter words stop_words.extend(list(string.ascii_lowercase)) func([w for w in word_list if not w in stop_words], sort) diff --git a/10-the-one/tf-10.py b/10-the-one/tf-10.py index 29f78c0..b9905f1 100755 --- a/10-the-one/tf-10.py +++ b/10-the-one/tf-10.py @@ -35,7 +35,7 @@ def scan(str_data): def remove_stop_words(word_list): with open('../stop_words.txt') as f: - stop_words = f.read().split(',') + stop_words = f.read().strip('\n').split(',') # add single-letter words stop_words.extend(list(string.ascii_lowercase)) return [w for w in word_list if not w in stop_words]