I have this dictionary:
>>> times
{'time':[0,1,0], 'time_d':[0,1,0], 'time_up':[0,0,0]}
I want to make this output, the order of the values matters!:
0 1 0 0 1 0 0 0 0
# 0 1 0 | 0 1 0 | 0 0 0 === time | time_d | time_up items of the list
For been more exactly I want a list like this:
[0,1,0,0,1,0,0,0,0]
Not use print()
.
Without a list comprehension I can do:
tmp = []
for x in times.values():
for y in x:
tmp.append(y)
I tryied using some list comprehensions but anyone works, like this two:
>>> [y for x in x for x in times.values()]
[0,0,0,0,0,0,0,0,0]
>>> [[y for x in x] for x in times.values()]
[[0,0,0],[0,0,0],[0,0,0]
How can I solve this with in one line (list comprehension))?