问题
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