Dreampie 是一种替代 Python shell,就像 IPython 一样。
它的主要卖点是界面,分为历史框和代码框。您在代码框中键入内容,您的代码不会与之前命令的输出混淆。
不幸的是,它不是 CLI 应用程序,并且通过 SSH 使用起来更加困难。此外,IPython 嵌入功能要优越得多。
是否可以使用 IPython 模拟此行为?
最佳答案
如前所述,您可以使用Grate IPython笔记本。
在常规 CLI ipython 中,您无法分割屏幕,但您可以使用 %edit magic 来输入多行文本,或编辑预览行,
In [2]: %edit #VIM, or other editor, opens and let you edit your code.
IPython will make a temporary file named: /tmp/ipython_edit_GHc1Wg.py
Editing... done. Executing edited code...
Out[2]: 'def hello():\n print "hello world"\n' #This is the code I entered in VIM
In [3]: hello()
hello world
In [4]: %edit _2 #I repoened VIM and ask it to reedit the stuff in the ouput of line [2]
IPython will make a temporary file named: /tmp/ipython_edit_k7l0Wc.py
Editing... done. Executing edited code...
Out[4]: 'def hello():\n print "godbye world"\n'
In [5]: hello()
godbye world
<小时/>
另一个选项是使用 VIM-Ipython ( https://github.com/ivanov/vim-ipython ),您可以在 VIM 中键入文本,选择部分代码并在 VIM 内的 IPython-shell 窗口中执行它。
关于python - 在 ipython 中模拟 dreampie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21453284/