A non-empty string is always True in python. So “null” evaluates to True in a boolean operation, just as “Apple”.
In Python, there is no null keyword or object available. Instead, you may use the ‘None’ keyword, which is an object.
Example null string Python
"" is an empty string,
"null" is not:
How to declare a null string in python?
The equivalent of the null keyword in Python is None.
str1 = None print(str1) print(type(str1))
Do comment if you have any doubts and suggestions on this Python string topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.