python创建多维数组的3种方式:
#coding=utf-8
import numpy as np
#1
image =[[(col+1)*(row+1) for col in range(5)] for row in range(3)]
a = np.array(image)
print(a)
#2
new_image =np.zeros((3,5))
#3
b = np.arange(12).reshape(3,4)
print(b)
---------------------
【转载,仅作分享,侵删】
作者:Fan9_
原文:https://blog.csdn.net/MrR1ght/article/details/80808299
|
|