Answers for "get rid of variables in python"

5

python undefine variable

# Basic syntax:
del variable

# Example usage:
variable = 42
print(variable)
--> 42
del variable
print(variable)
--> NameError: name 'variable' is not defined
# Note, this error is what we expect now that the variable has been
# 	deleted
Posted by: Guest on September-27-2020

Code answers related to "get rid of variables in python"

Python Answers by Framework

Browse Popular Code Answers by Language