From cfa34e4c1490f8852498c894c9b9ca4ec29826e8 Mon Sep 17 00:00:00 2001 From: fbattello Date: Tue, 8 Nov 2022 12:50:37 +0100 Subject: [PATCH] In create_json.py replaced the loop with a more pythonic dict comprehension --- scripts/create_json.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/create_json.py b/scripts/create_json.py index 193f028..4d8c845 100755 --- a/scripts/create_json.py +++ b/scripts/create_json.py @@ -33,8 +33,6 @@ import json words = open(sys.argv[1]) word_list = words.readlines() -json_words = {} -for count in range(len(word_list)): - json_words[word_list[count].rstrip()] = '1' +json_words = {word.rstrip(): "1" for word in word_list} print(json.dumps(json_words, indent=4))