Managing variables in IPython

After working in IPython for a while, sometimes you’d like to use a variable you created way back at the beginning, but you don’t remember exactly what it was called. Here are some useful commands for working with variables in IPython.

who show contents of workspace
who int show integers in workspace
whos show details of workspace contents
whos int show details of integers in workspace
psearch msg* search for objects in the workspace starting with msg
psearch msg* int restrict search to just integers
reset delete all variables from workspace

3 Responses to “Managing variables in IPython”


  • Thanks for the post! You may also want to add that you can use “del varname” to delete a single variable from the workspace.

  • And how do you clear (delete) a subset of variables? If your workspace contains variables a, b, c, d, e, f, how do you clear in one shot variables a, d, f for example and leave b, d, e intact in the workspace for future use?

  • You can use the syntax

    del a,d,f
    

Leave a Reply