THE WORLD'S LARGEST WEB DEVELOPER SITE

Python None Keyword

❮ Python Keywords


Example

Assign the value None to a variable:

x = None

print(x)
Run example »

Definition and Usage

The None keyword is used to define a null value, or no value at all.

None is not the same as 0, False, or an empty string. None is a datatype of its own (NoneType) and only None can be None.


More Examples

Example

If you do a boolean if test, what will happen? Is None True or False:

x = None

if x:
  print("Do you think None is True")
else:
  print("None is not True...")
Run example »

❮ Python Keywords