Reputation: 63022
There are a number of questions about how to force EXECUTE
instead of newline
in ipython
. But I need the opposite. Consider:
In [9]: import sqlalchemy sqlalchemy.__version__
File "<ipython-input-9-84bd5002c701>", line 1
import sqlalchemy sqlalchemy.__version__
^
SyntaxError: invalid syntax
We can see that there should be two lines: ( 1 ) the import
and ( 2 ) the __version__
invocation. Whatever I try I can not separate the two pieces.
One of the suggestions was ctl-v ctl-j
: that simply did an EXECUTE
again.
Another suggestion was Use %edit {tag}
Adding line breaks in ipython : That gave an even more interesting behavior:
n [12]: %edit _i9
Editing... done. Executing edited code...
Out[12]: 'import sqlalchemy \nsqlalchemy.__version__ \n'
So notice: the (vi
) editor did its job but then ipython
simply converted the newlines to \n
and did not interpret the newlines instead it concatenated them
So what key combination will get us the newline
here?
Upvotes: 2
Views: 1733