variable = None in Python? What does it mean?

python, python-2.7

Solution

It sets a variable named `variable` to `None` (Python's version of a null/nonetype object).

See a demonstration below:

>>> variable = None
>>> type(variable)
<type 'NoneType'>
>>>

I really think you should read one of the many Python tutorials out there since this is a fundamental language concept. Here are some I found useful:

http://docs.python.org/2/tutorial/

http://www.tutorialspoint.com/python/python_overview.htm

Problem

I am new to coding. I saw some code where variable = None, what does it mean? I can't find an answer anywhere online. Thanks in advance!

Original source

Related problems