I have this list:
input = [[[1,2]], [[3,4]], [[5,6]]]
Wanted output:
output = [[1,3,5],[2,4,6]]
I have tried this:
x, y = map(list,zip(*input))
to later realize that this method wont work because of the redundant square brackets, is there a way to solve this without iteration.
You can try this:
>>> from operator import itemgetter
>>> input = [[[1,2]], [[3,4]], [[5,6]]]
>>> list(zip(*map(itemgetter(0), input)))
[(1, 3, 5), (2, 4, 6)]