Suppose I have several lists of length n:
a = [1, 2, 3]
b = [4, 5, 6]
c = [7, 8, 9]
d = [-1, -2, -3]
I put those lists into a list:
x = [a, b, c]
Now I'd like to end up with the following list:
y = [[1, 4, 7, -1], [2, 5, 8, -2], [3, 6, 9, -3]]
What is a quick and pythonic way to do so? (To get from x
to y
.)
The entries could be anything, I use numbers just because they visualize good.