"""
给定一个m*n阶的二维数组,返回n*m阶二维数组,也就是行列互换
eg:
input: arr = [[1,2,3],[1,2,3]]
output: arr = [[1,1],[2,2],[3,3]]
"""
def func(arr, m, n):
res = [[row[i] for row in arr] for i in range
python二维数组行列互换
最新推荐文章于 2024-07-19 02:13:10 发布
"""
给定一个m*n阶的二维数组,返回n*m阶二维数组,也就是行列互换
eg:
input: arr = [[1,2,3],[1,2,3]]
output: arr = [[1,1],[2,2],[3,3]]
"""
def func(arr, m, n):
res = [[row[i] for row in arr] for i in range