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.
-
Good point -- it may take longer to wait for an SO answer, but you get reputation paints. – S.Lott Apr 26 '09 at 17:12
8 Answers
If you're using IDLE, you can use Ctrl+]
to indent and Ctrl+[
to unindent.

- 57,848
- 30
- 97
- 128
-
2hmm.. I'm working on a Norwegian keyboard and to make the '[' I have to hold down Alt Gr, but still its still want do the trick. – Thanx Apr 26 '09 at 12:28
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.

- 41,871
- 30
- 130
- 181
-
-
-
The only key combination I've found not to work here is the one that's used almost everywhere else, Shift + Tab. Brilliant. Anyways, Ctrl + Tab works, just have to remember it. – user1768761 Jun 26 '22 at 19:05
-
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+["

- 71
- 1
- 2
In Jupyter Notebook,
SHIFT+ TAB(to move left) and TAB(to move right) movement is perfectly working.

- 163
- 2
- 4
-
1He is asking the question about python idle not about Jupyter notebook? – Gayal Kuruppu May 17 '20 at 08:09
-
But often, Even if someone is looking for Jupyter notebook solution for the same, this link comes up. That is what exactly happened to me. So I thought of posting the answer to the notebook here. I hope it makes sense to you @GayalKuruppu !! – Saurav May 18 '20 at 09:33
-
no @Saurav SHIFT and SHIFT+TAB is used universally in most of the languages. it is not only for jupyter notebook. Every other editor uses that. IDLE is an exception here. Thats why the answer should be specific for that. Besides, your answer is given already as "Try shift + tab if you uses some other editors". Try to add something valuable to the question. – Gayal Kuruppu May 18 '20 at 09:42
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.)

- 11
- 5
-
Setting Shift + Tab doesn't work for me there. I ended up using Ctrl + Tab...... – user1768761 Jun 26 '22 at 19:07