如何在 IDLE 中删除多行制表符缩进?
如果您想在 Python IDLE 中缩进多行,只需标记这些行并按 Tab 键即可。 但是,如果您想删除多行中的缩进怎么办? Shift+Tab 在 IDLE 中不起作用。
If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果您使用的是 IDLE,则可以使用
Ctrl+]
缩进,使用Ctrl+[
取消缩进。If you're using IDLE, you can use
Ctrl+]
to indent andCtrl+[
to unindent.如果您使用的是 IDLE,并且挪威语键盘使 Ctrl-[ 出现问题,您可以更改键。
我尝试放入shift-Tab并且效果很好。
If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key.
I tried putting in shift-Tab and that worked nicely.
取决于你的编辑器。
您尝试过 Shift+Tab 吗?
Depends on your editor.
Have you tried Shift+Tab?
在 pythonwin 中,
SHIFT + TAB 有效
in pythonwin,
SHIFT + TAB works
对于 IDLE,选择行,然后打开“格式”菜单。 (如果您找不到它,则在“编辑”和“运行”之间。)这也会为您提供键盘快捷键,对我来说,缩进快捷键是“Ctrl+[”
For IDLE, select the lines, then open the "Format" menu. (Between "Edit" and "Run" if you're having trouble finding it.) This will also give you the keyboard shortcut, for me it turned out that dedent shortcut was "Ctrl+["
取决于你的编辑。
depends on your editor.
在 Jupyter 笔记本中,
In Jupyter Notebook,
默认情况下,IDLE 将其放在 Shift-左括号中。 但是,如果您愿意,可以通过单击选项 --> 将其自定义为 Shift-Tab。 配置IDLE --> 按键 --> 使用自定义按键集 --> 缩进区域 --> 获取新的选择键
然后您可以选择您想要的任何组合。 (不要忘记单击“应用”,否则所有设置都不会受到影响。)
By default, IDLE has it on Shift-Left Bracket. However, if you want, you can customise it to be Shift-Tab by clicking Options --> Configure IDLE --> Keys --> Use a Custom Key Set --> dedent-region --> Get New Keys for Selection
Then you can choose whatever combination you want. (Don't forget to click apply otherwise all the settings would not get affected.)