使用NumPy创建全零数组:Python代码示例
使用NumPy库中的zeros函数可以创建一个长度为10,元素都为0的ndarray对象。\n\n代码如下所示:\n\npython\nimport numpy as np\n\narr = np.zeros(10)\nprint(arr)\n\n\n输出结果:\n\n\n[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n
原文地址: https://www.cveoy.top/t/topic/pR9D 著作权归作者所有。请勿转载和采集!