matrix = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12],
]
# 方法一
# for x in range(len(matrix)):
# print (matrix[x])
# pass
hehe = [[row[i] for row in matrix] for i in range(4)]
print (hehe)
# 方法二
one = []
for x in range(4):
one.append([row[x] for row in matrix])
pass
print (one)
# 方法三
three = []
for x in range(4):
two = []
for i in matrix:
two.append(i[x])
pass
three.append(two)
pass
print (three)
![](https://i-blog.csdnimg.cn/blog_migrate/5b77957483a235dd63cf0d0d8017870a.png)