読者です 読者をやめる 読者になる 読者になる

転置行列

a = [range(10), range(11,20), range(21,30)]
b = map(list, zip(*a))

print a
print b
[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[11, 12, 13, 14, 15, 16, 17, 18, 19],
[21, 22, 23, 24, 25, 26, 27, 28, 29]]

[[0, 11, 21],
[1, 12, 22],
[2, 13, 23],
[3, 14, 24],
[4, 15, 25],
[5, 16, 26],
[6, 17, 27],
[7, 18, 28],
[8, 19, 29]]

おっかないですね.