Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spyder - clear variable explorer along with variables from memory

Tags:

python

spyder

To clear the console we can use the following command -

import subprocess as sp
tmp = sp.call('cls',shell=True)

However, to remove a variable from memory, we often rely upon -

  • using del command
  • removing variable manually by using the drop-down menu in variable explorer

But both of them are variable specific and hence time-consuming. So is there any general command (like clear under MATLAB) to remove a variable from memory and thereafter from Spyder's Variable Explorer.

like image 299
sync11 Avatar asked Aug 24 '17 05:08

sync11


People also ask

How do you refresh a variable Explorer in Spyder?

To trigger a refresh, simply click the reload button on the Variable Explorer toolbar, or press the shortcut Ctrl+R ( Cmd-R ) when it has focus.

How do you reset all variables in Python?

python clear all variables To clear Variables in Python just use %reset-f. You can clear variables in python by using %reset-f function. If you want to delete any specific variable then use %reset-f.

Which command is used to clear console in Spyder?

CTRL + L does clear the terminal screen but it does not clear variables--you need a kernel restart for that.


1 Answers

Go to the IPython console in the Spyder IDE and type %reset. It will prompt you to enter (y/n) as the variables once deleted cannot be retrieved. Type 'y' and hit enter. That's it.

like image 193
NKoder Avatar answered Sep 17 '22 13:09

NKoder