np.zeros(),np.empty()
np.zeros(shape, dtype=float, order=‘C’)返回值: 返回一个给定形状和类型的用0填充的数组参数:shape: 形状dtype:数据类型,可选参数,默认numpy.float64import numpy as nparray1 = np.zeros(5, np.float32) #生成包含5个元素的零一维数组,且各元素为float32print(array1, array1.shape, array1.dtype) # [0. 0. 0. 0. 0.]