Suppose I have the following dict object:
test = {} test['tree'] = ['maple', 'evergreen'] test['flower'] = ['sunflower'] test['pets'] = ['dog', 'cat']
Now, if I run test['tree'] + test['flower'] + test['pets'] , I get the result:
['maple', 'evergreen', 'sunflower', 'dog', 'cat']
what I want.
However, suppose I'm not sure which keys are in the dict object, but I know that all values will be lists. Is there a way like sum(test.values()) or something that I can run to achieve the same result?
source share