Say that you have a list of lists, of lists, for example
lll = [(['a', 'b'], [1, 2], [True, False]),
(['c'], [3], [True]),
(['d', 'e', 'f', 'g'], [4, 5, 6, 7], [True, False, True, False])]
For each item in lll, I would like a list of the ith element in each of the items list, and I want all these lists in one list.
This is very tricky to describe with words as you can imagine, but I would like the final result to be like this
result = [
['a', 1, True],
['b', 2, False].
['c', 3, True],
['d', 4, True],
['e', 5, False],
['f', 6, True],
['g', 7, False]
]
What I tried so far is
newList = []
for item in lll:
num_things = len(item[0])
for ii in range(num_things):
newList.append([x[ii] for x in item])
newList
Is there a more pythonically elegant way to get this result?