>>> d = {'a': [1, 2, 3], 'b': [5, 6, 7], 'c': [9, 0]}
>>> [y for x in d.values() for y in x]
[1, 2, 3, 9, 0, 5, 6, 7]
This is an embedded understanding. To show how this works, you can split it into lines to see its structure as nested loops for. It goes from left to right.
[y
for x in d.values()
for y in x]
source
share