numpy.sctype2char()函数– Python
numpy.sctype2char()
函数返回标量 dtype 的字符串表示形式。
Syntax : numpy.sctype2char(sctype)
Parameters :
sctype : [scalar dtype or object] If a sctype is a scalar dtype, the corresponding string character is returned. If an object, sctype2char tries to infer its scalar type and then return the corresponding string character.
Return : [str] The string character corresponding to the scalar type.
代码#1:
# Python program explaining
# numpy.sctype2char() function
# importing numpy as geek
import numpy as geek
x = geek.array([1., 2-1.j])
gfg = geek.sctype2char(x)
print (gfg)
输出 :
D
代码#2:
# Python program explaining
# numpy.sctype2char() function
# importing numpy as geek
import numpy as geek
gfg = geek.sctype2char(list)
print (gfg)
输出 :
0