Invoke the editor in the interactive mode

放肆的年华 提交于 2019-12-11 00:43:49

问题


When open an editor within Ipython, I usually issue commands

In [13]: subprocess.run('vim Person.py', shell=True)
Out[13]: CompletedProcess(args='vim Person.py', returncode=0)

How to do it in a straight-forwards method?


回答1:


The %edit magic command is the canonical way offered by IPython. It invokes an editor specified by $EDITOR, optionally loading a specified file, and executes the code after it's closed.

Another common workflow is to have editor and console open in different windows and copy-paste between the two (the %paste magic is handy here).

Jupyter Notebook seems to offer experience similar to MATLAB console though I don't have any experience with it.



来源:https://stackoverflow.com/questions/50441346/invoke-the-editor-in-the-interactive-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!