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']
which is what I want.
However, suppose that I'm not sure what keys are in the dict object but I know all the values will be lists. Is there a way like sum(test.values())
or something I can run to achieve the same result?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…