python float NaN

尝试了以下几种方法,都没有成功:

>>> a = float('NaN')

  1. >>> a == 'NaN'
    False
  2. >>> a == nan         
    False
  3. >>> a == float('NaN')
    False
  4. >>> isNaN(a)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    NameError: name 'isNaN' is not defined

最后找到一种感觉是非标准的方法,但是可行:

>>> a != a

True

http://blog.csdn.net/sunlisten/article/details/7437727

你可能感兴趣的:(python float NaN)