python - 在 ipython 中模拟 dreampie

标签 python ipython

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/

相关文章:

python - Django 中基于 XMPP 的实时聊天系统

python - Django shell 中的奇怪字符,箭头键不起作用

python - wxpython 防止Ctrl+Enter改变焦点

python - 使用 python 通过串行发送十六进制

python - IPython 笔记本中的 Pyzmq 错误

python - 木星 SSL : WRONG_VERSION_NUMBER

python - 这是在 IPython 中分配变量和直接在数组中工作的区别

python - 如何在 Jupyter 中将变量从 javascript 传递到 python?

python - 改变继承的 Django 模型的独特字段

python - 匹配字符串,其中多个捕获组在正则表达式中必须不同