How to insert a literal tab instead of auto-completing in Jupyter?

时光毁灭记忆、已成空白 提交于 2019-12-22 08:13:14

问题


It is easy to indent a whole line.

  1. Just highlight the whole line and press Tab

  2. Go to the start of the line and press Tab

  3. Click anywhere in the line and press Ctrl + ]

Now the problem is how to insert indent in the middle of the line.

And also, how to indent at the end of the line.

Example usage scenario:

# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar

Concretely, we want:

# Hyperparameters
LENGTH = 10    # length of foo
TEMP = 20      # temperature of bar
IV = 99.99     # induction variability of foo bar

Or even better (in some cases):

# Hyperparameters
LENGTH = 10        # length of foo
TEMP   = 20        # temperature of bar
IV     = 99.99     # induction variability of foo bar
  1. Note that by pressing the Tab button however, we are actually calling auto-complete instead of indenting.
  2. Of course we can always manual align them by using spacebar, but then we will have to do this every time we tune the hyperparameters.

So, how to indent instead of auto-completing in Jupyter?

P.S. Yes, I am aware of print("\t"), copying the output and pasting the indent. But that is not desirable.

来源:https://stackoverflow.com/questions/49497106/how-to-insert-a-literal-tab-instead-of-auto-completing-in-jupyter

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