views:

721

answers:

5

If you want to indent several lines in Python you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Is there a quick way to do that?

Thanks

edit: I use IDLE.

A: 

Depends on your editor.

Have you tried Shift+Tab?

Loïc Wolff
Have tried this, not working.
Thanx
A: 
Shift-Tab
Ctrl-Tab
< key

depends on your editor.

ldigas
+2  A: 

If you're using IDLE, you can use Ctrl+] to indent and Ctrl+[ to unindent.

Smashery
hmm.. 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
+5  A: 

If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key.

  1. Go Options->Configure IDLE.
  2. Click the Keys tab.
  3. If necessary, click Save as New Custom Key Set.
  4. With your custom key set, find "dedent-region" in the list.
  5. Click Get New Keys for Selection.
  6. etc

I tried putting in shift-Tab and that worked nicely.

Craig McQueen
Nice - I might change to shift+tab
Smashery
A: 

Thank you. That works. Shift-Tab does not work by default in IDLE.