nutbunny
nutbunny

Reputation: 89

Is there a reset function in the Python console?

Is there a function that can be called from within the Python console that has the exact same effect as doing the following:

Calling

   exit()

to exit the console, followed by calling

python

at the command prompt to re-enter a fresh python console.

NB: I am not seeking to just clear or de-clutter the screen, because using CTRL+L accomplishes that quite easily.

Upvotes: 0

Views: 9425

Answers (1)

NGS
NGS

Reputation: 21

If you want to get rid of the variables defined in the session then this should do your job.

import gc

del <variable_name>
gc.collect()

Upvotes: 1

Related Questions