Home > Backend Development > Python Tutorial > The difference between python None and Null

The difference between python None and Null

高洛峰
Release: 2016-10-19 16:15:49
Original
2045 people have browsed it

1. Python objects

To understand this, you must first understand Python objects:

Python objects have three characteristics: identity, type, and value.

Three properties are assigned when the object is created. Only the value can be changed, others are read-only.

Types themselves are also objects.

2. Null and None

is a special type of Python, Null object or None Type, it has only one value None.

It does not support any operations and does not have any built-in methods.

None and any other data Type comparisons always return False.

None has its own data type NoneType.

You can copy None to any variable, but you cannot create other NoneType objects.

>>> type(None)
<class &#39;NoneType&#39;>
>>> None == 0
False
>>> None == &#39; &#39;
False
>>> None == None
True
>>> None == False
False
Copy after login



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template