[Solved] Python: Save keywords in a list and add another list to the single words in it [closed]


To fix the KeyError you can do the following thing:

variable = {}
for word in wordlist:
    variable[word] = []
    for boolean in booleanlist:
        variable[word].append(True)

Note that in this code snippet every keyword has the same list of Booleans, but that’s what you have given to us.


edit: removed the global declaration, it was there only because the OP had it.

3

solved Python: Save keywords in a list and add another list to the single words in it [closed]