How to Refer to a Null Object in Python


If you need to refer to a Null Object in your Python code, then you can do the following.

It is important to note that Python does not have a Null type, instead Python refers to not set objects or variables as None.

We can use the is keyword to check if an object or variable has the type of None.

object_name = None
print(object_name is None)

object_name = ' some_value'
print(object_name is None)