发布网友 发布时间:2022-05-09 14:49
共2个回答
热心网友 时间:2022-04-18 20:29
方法一,在list下操作,使用extend函数
for i in range(len(a)):方法二,将list转成ndarray,然后使用矩阵的粘合方法
import numpy as np热心网友 时间:2022-04-18 21:47
1 方法一
>>> matrix =[[1,2,3,4],[5,6,7,8],[9,10,11,12]]
>>> transposed =[]
>>>for i in range(4):
transposed_row =[]
for row in matrix:
transposed_row.append(row[i])
transposed.append(transposed_row)