I've created a dictionary instance without any key: value pairs, standard
dict = {}
I'm then returning back some information from an API to be added to this dictionary dependent on some variables name.
some_variables_name1 = str(some_variable1)
dict[some_variables_name1] += [{ 'key1': value1 }]
some_variables_name2 = str(some_variable2)
dict[some_variables_name2] += [{ 'key2': value2 }]
However, I seem to be getting an error similar to this *Assuming that str(some_variable1) is equal to 'foo'
:
KeyError: 'foo'
Any pro tips?