1def a_func():
2 return 0
3a_num = 5
4print(dir())
5>>> ['__builtins__', '__doc__', ..., 'a_func', 'a_num']
6for element in dir():
7 if element[0:2] != "__":
8 del globals()[element]
9
10del element
11print(dir())
12>>> ['__builtins__', '__doc__', ...]