1

我正在尝试更新此处找到的脚本以与 IPython 0.13.1 一起使用,并达到了停顿状态。脚本调用

import IPython.ipapi
ip = IPython.ipapi.get()
for var in self.magic_who_ls():
        try:
            pickle.dump(user_ns[var],fout,1)
            saved_vars.append(var)
        except:
            # An object that cannot be pickled was encountered
            print("Unable to save object: %s" % var)

我知道IPython.ipapi已移至IPython.core.ipapiexpose_magic已重命名为define_magic,而magic_who_ls已重命名为who_ls,但我无法从脚本中调用who_ls来获取命名空间变量的列表。谁能给我一个提示?

4

1 回答 1

2
import IPython
ip = IPython.core.ipapi.get()
for var in ip.run_line_magic('who_ls', ''):
  # potato
于 2013-03-12T02:14:38.450 回答