Adding line breaks in ipython

前端 未结 7 680
长发绾君心
长发绾君心 2020-12-12 14:38

If introduce a for loop in iPython, or any multi-line command, how do I go back and add lines to it? I ran this:

for row in table.find_all(\'tr\'):
    cells         


        
7条回答
  •  半阙折子戏
    2020-12-12 15:33

    There is also a way to add a newline directly in the repl: ctrl-v, ctrl-j

    The ctrl-v basically lets you send a control code and then the ctrl-j is the code for a newline (line-feed). It's a bit awkward to type but has the advantage of also working in the regular Python shell as well as in Bash itself.

    Edit: At least in iTerm2, you can assign it to a single hotkey as well. I set ctrl-enter to "Send hex codes" of 0x16 0x0a. Could also use cmd-enter or whatever else.

提交回复
热议问题