-2

Is there an ipython magic command that will print the variables in the current namespace?

The ipython documentation is here and I don't see an answer to this.

A list of magic commands in ipython is here.

djechlin
  • 59,258
  • 35
  • 162
  • 290
  • 2
    Possible duplicate of [Viewing all defined variables](http://stackoverflow.com/questions/633127/viewing-all-defined-variables) – Maximilian Peters May 01 '16 at 16:32
  • @Ashafix not really, that's a python question, the only ipython answer is buried deep. If there's a better ipython answer it would need to go on a question about ipython. – djechlin May 01 '16 at 16:36
  • Just learned something new, when you flag it by linking to an answer, SO links to the question. http://stackoverflow.com/a/634581/2776376 – Maximilian Peters May 01 '16 at 16:38
  • Hmm, I wonder how this question could be improved. Maybe somebody is upset it's a duplicate (which is only partly true) [even though we explicitly encourage having duplicate questions](http://meta.stackexchange.com/a/32315/183887). – djechlin May 01 '16 at 17:56
  • `who` and `whos` give a summary of the variables, but not necessarily their full values. That's especially true with complex items like numpy arrays. – hpaulj May 01 '16 at 19:22

1 Answers1

2

It's answered in this SO question: https://stackoverflow.com/a/634581/1339987

The command is who. Here is some sample code:

In [9]: who

You can also use whos for more detail, like this:

In [10]: whos
Community
  • 1
  • 1
djechlin
  • 59,258
  • 35
  • 162
  • 290
  • If the answer to a question is the same as another question, mark it as a duplicate. – MattDMo May 01 '16 at 17:50
  • @MattDMo no, there's probably a better ipython solution and it wouldn't get posted on the source question about python. Duplicates aren't perfect. – djechlin May 01 '16 at 17:54