Search This Blog

Python: del or assign None?


>>> x=1
>>> print x
1
>>> del x
>>> print x
Traceback (most recent call last):
File "", line 1, in
NameError: name 'x' is not defined

>>> x=1
>>> print x
1
>>> x=None
>>> print x
None

see also

No comments:

Post a Comment