I\'ve been searching for the accurate answer to this question for a couple of days now but haven\'t got anything good. I\'m not a complete beginner in programming, but not y
This worked for me.
You need to run it twice once for globals followed by locals
for name in dir(): if not name.startswith('_'): del globals()[name] for name in dir(): if not name.startswith('_'): del locals()[name]