是否可以使用先前执行中的现有变量来运行 .py 代码文件?我的意思是使用内存中的变量运行新的 .py 文件,即输入 who
命令时看到的变量。
最佳答案
在 Ipython 中,使用 run -i myscript.py
。从文档中,
-i run the file in IPython's namespace instead of an empty one. This is useful if you are experimenting with code written in a text editor which depends on variables defined interactively.
关于python - IPython : Running a . 使用现有变量的py文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22557975/