列表推导式~
N=int(10) #二维数组 a=[[j for i in range(N)] for j in range(20)] a[1][1]=8 a[1][2]=2 for i in range(N): for j in range(N): print(a[i][j],end=' ') print('') # 多维数组 a=[[[i for j in range(N)] for k in range(3)] for i in range(5)] for i in range(5): for j in range(M): print(a[i][j]) print('')
标签:10,20,python,range,数组,print From: https://www.cnblogs.com/towboa/p/17308136.html