缩进整行很容易。
Just highlight the whole line and press Tab
Go to the start of the line and press Tab
Click anywhere in the line and press Ctrl + ]
Now the problem是如何在行中间插入缩进。
还有,如何在行尾缩进。
使用场景示例:
# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar
具体来说,我们想要:
# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar
或者甚至更好(在某些情况下):
# Hyperparameters
LENGTH = 10 # length of foo
TEMP = 20 # temperature of bar
IV = 99.99 # induction variability of foo bar
- Note that by pressing the Tab button however, we are actually calling auto-complete instead of indenting.
- 当然,我们总是可以使用空格键手动对齐它们,但是每次调整超参数时我们都必须这样做。
那么,如何在 Jupyter 中缩进而不是自动完成呢?
附:是的,我知道 print("\t"),复制输出并粘贴缩进。但这是不可取的。
一种替代方法是使用 Alt 键盘序列。
在这种情况下,它将是Alt + 09
。这大约是人们所希望的最短的时间。
为此,您需要键盘上有一个小键盘,因为键盘上的顶行数字无法生成 Alt 键盘序列。
然而,这确实在选项卡的位置留下了相当丑陋的箭头,这似乎是 Jupyter Notebooks 显示选项卡字符的方式。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)