Close

Python None Type

[Last Updated: Feb 3, 2022]

In Python None keyword is used to represent a null value:

scripts/none-type.py

x = None
print(x)
print(type(x))

Output

None
<class 'NoneType'>

Function returning nothing

A function which returns nothing can be assigned to a variable. That variable will have None value:

scripts/function-none-return-type.py

def run():
    print('running')
x = run();
print(x);

Output

running
None

Example Project

Dependencies and Technologies Used:

  • Python 3.10.2
Python None Type Select All Download
  • python-none-type
    • scripts
      • none-type.py

    See Also