Empty type
None is a special value. It cannot be said to be 0, nor is it a string. None means nothing, it is empty. object.
None is a special constant. (Recommended learning: Python video tutorial)
None is different from False.
None is not 0.
None is not an empty string.
None will always return False when compared with any other data type.
None has its own data type NoneType.
You can copy None to any variable, but you cannot create other NoneType objects.
Nonetype and null value are inconsistent. It can be understood that Nonetype means that this parameter does not exist. Null value means that the parameter exists, but the value is empty.
The judgment method is as follows:
if hostip is None: print "no hostip,is nonetype" elif hostip: print "hostip is not null" else: print " hostip is null"
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of What is the python empty type?. For more information, please follow other related articles on the PHP Chinese website!