In create_json.py replaced the loop with a more pythonic dict comprehension

This commit is contained in:
fbattello 2022-11-08 12:50:37 +01:00
parent 60eb05a128
commit cfa34e4c14

View File

@ -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))