Python/ref math isnan
来自菜鸟教程
<languages />
Python math.isnan()方法
例
检查值是否为NaN:
# Import math Library
import math
# Check whether some values are NaN
or not
print (math.isnan (56))
print
(math.isnan (-45.34))
print (math.isnan (+45.34))
print (math.isnan
(math.inf))
print (math.isnan (float("nan")))
print (math.isnan
(float("inf")))
print (math.isnan (float("-inf")))
print (math.isnan
(math.nan))
定义和用法
The
math.isnan()
方法检查值是否为NaN(非数字)。
如果指定的值为NaN,则此方法返回True,否则返回False。
句法
math.isnan(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。要检查的值 |
技术细节
| 返回值: | A
|
| Python版本: | 3.5 |