In create_json.py replaced the loop with a more pythonic dict comprehension
This commit is contained in:
parent
60eb05a128
commit
cfa34e4c14
@ -33,8 +33,6 @@ import json
|
|||||||
|
|
||||||
words = open(sys.argv[1])
|
words = open(sys.argv[1])
|
||||||
word_list = words.readlines()
|
word_list = words.readlines()
|
||||||
json_words = {}
|
json_words = {word.rstrip(): "1" for word in word_list}
|
||||||
for count in range(len(word_list)):
|
|
||||||
json_words[word_list[count].rstrip()] = '1'
|
|
||||||
|
|
||||||
print(json.dumps(json_words, indent=4))
|
print(json.dumps(json_words, indent=4))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user