In [68]: a=None
In [69]: a
In [70]: type(a)
Out[70]: NoneType
In [71]: if a == None:
...: print("a is None")
...:
a is None
In [72]: if type(a) == 'NoneType':
...: print('type of a is NoneType')
...:
In [73]: if type(a) == NoneType:
...: print('type of a is NoneType')
...:
...:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-73-915af4f5ae3c> in <module>()
----> 1 if type(a) == NoneType:
2 print('type of a is NoneType')
3
4
NameError: name 'NoneType' is not defined
关于Python中None的一点尝试
最新推荐文章于 2024-03-02 18:02:59 发布