Python/ref cmath isnan
来自菜鸟教程
<languages />
Python cmath.isnan()方法
例
检查复数值是否为NaN:
#import cmath for complex number operations
import cmath
#find
whether a complex number is NaN or not
print (cmath.isnan(12 +
float('nan')))
print (cmath.isnan(2 + 3j))
定义和用法
The
cmath.isnan()
方法检查值是否为nan(非数字)。此方法返回一个布尔值:
True
如果值是nan,否则
False
句法
cmath.isnan(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。要检查NaN的值 |
技术细节
| 返回值: | A
|
| Python版本: | 2.6 |