在 Python 中引用 null 对象 [英] Referring to the null object in Python
本文介绍了在 Python 中引用 null 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 Python 中引用 null 对象?
How do I refer to the null object in Python?
推荐答案
在 Python 中,'null' 对象是单例 None
.
In Python, the 'null' object is the singleton None
.
检查无"的最佳方法是使用身份运算符,is
:
The best way to check things for "Noneness" is to use the identity operator, is
:
if foo is None:
...
这篇关于在 Python 中引用 null 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文