如何列出 ipython 会话中加载的所有名称?

How to list all names loaded in in an ipython sessions?

我通过将一些 *.py 文件放入 ~/.ipython/profile_default/startup.

来将变量和函数注入我的默认 ipython 命名空间

我可以通过键入 %who%who_ls 列出在 ipython 会话中新创建的名称。但是,我的启动文件中定义的名称没有显示出来。是否有神奇的功能或方法可以将启动目录中引入的所有名称列出到活动的 ipython 交互式会话中?

您可以通过 %psearch 使用模式搜索。要列出不在内置 space 中的所有对象,请使用:

%psearch -e builtin *

%psearch [options] PATTERN [OBJECT TYPE]

Note: ? can be used as a synonym for %psearch, at the beginning or at the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the rest of the command line must be unchanged (options come first), so for example the following forms are equivalent

%psearch -i a* function -i a* function? ?-i a* function