问题
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.
回答1:
If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key.
- Go Options->Configure IDLE.
- Click the Keys tab.
- If necessary, click Save as New Custom Key Set.
- With your custom key set, find "dedent-region" in the list.
- Click Get New Keys for Selection.
- etc
I tried putting in shift-Tab and that worked nicely.
回答2:
If you're using IDLE, you can use Ctrl+]
to indent and Ctrl+[
to unindent.
回答3:
Depends on your editor.
Have you tried Shift+Tab?
回答4:
in pythonwin,
SHIFT + TAB works
回答5:
Shift-Tab
Ctrl-Tab
< key
depends on your editor.
回答6:
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+["
回答7:
In Jupyter Notebook,
SHIFT+ TAB(to move left) and TAB(to move right) movement is perfectly working.
回答8:
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.)
来源:https://stackoverflow.com/questions/790711/how-to-remove-tab-indent-from-several-lines-in-idle