📜  numpy.matlib.zeros()函数| Python

📅  最后修改于: 2022-05-13 01:54:36.110000             🧑  作者: Mango

numpy.matlib.zeros()函数| Python

numpy.matlib.zeros()函数返回给定形状和类型的矩阵,用零填充。

代码#1:

# Python program explaining
# numpy.matlib.zeros() function
  
# importing numpy as geek 
# and importing matlib module  
import numpy as geek
import numpy.matlib
  
gfg = geek.matlib.zeros((3, 3))
  
print (gfg)

输出 :

[[ 0.  0.  0.]
 [ 0.  0.  0.]
 [ 0.  0.  0.]]


代码#2:

# Python program explaining
# numpy.matlib.zeros() function
  
# importing numpy as geek 
# and importing matlib module  
import numpy as geek
import numpy.matlib
  
gfg = geek.matlib.zeros(4)
  
print (gfg)

输出 :

[[ 0.  0.  0.  0.]]