Is there a way to clear the value of a variable in python?
For example if I was implementing a binary tree:
Class Node: self.left = somenode1
If want to totally delete it use del:
del
del your_variable
Or otherwise, to Make the value None:
None
your_variable = None
If it's an iterable (such as a list or tuple), you can make it empty like:
your_variable.clear()
Then your_variable will be empty
your_variable