Answers for "python clear variable"

1

python how to delete a variable

del <Object name you want to delete>
Posted by: Guest on November-12-2021
1

del all variables python

def a_func():
    return 0
a_num = 5
print(dir())
>>> ['__builtins__', '__doc__', ..., 'a_func', 'a_num']
for element in dir():
    if element[0:2] != "__":
        del globals()[element]

del element
print(dir())
>>> ['__builtins__', '__doc__', ...]
Posted by: Guest on April-18-2021
1

delete variable python

f = 11;
print(f)
del f
print(f)
Posted by: Guest on February-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language