创建一个长度为10元素都为0的ndarray对象的语句
可以使用numpy库中的zeros函数来创建一个长度为10,元素都为0的ndarray对象。
代码如下所示:
import numpy as np
arr = np.zeros(10)
print(arr)
输出结果:
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
原文地址: https://www.cveoy.top/t/topic/h9mL 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
可以使用numpy库中的zeros函数来创建一个长度为10,元素都为0的ndarray对象。
代码如下所示:
import numpy as np
arr = np.zeros(10)
print(arr)
输出结果:
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
原文地址: https://www.cveoy.top/t/topic/h9mL 著作权归作者所有。请勿转载和采集!