user5300247
user5300247

Reputation:

How do I unindent blocks of code in Python?

I am using Python 2.7.10 and am having trouble trying to unindent a block of code. Surely there is some sort of shortcut, instead of having to backspace every individual line?

From the Python Shell, I opened a new file (.py) and that's where I am writing the code.

Shift + Tab does not work.

Upvotes: 13

Views: 69524

Answers (2)

Shubham Sharma
Shubham Sharma

Reputation: 1831

You can unindent using following keys:

In Python IDLE/Spyder: Ctrl + [
In Eclipse: Shift + Tab
In Visual Studio: Shift+ Tab
In PyCharm: Shift + Tab
In Jupyter Notebook: Shift + Tab

Upvotes: 23

Psytho
Psytho

Reputation: 3384

It is Ctrl + [ in IDLE. You can change it to your favorite Shift + Tab in Options -> Configure IDLE - Keys. You need to restart the shell after that.

Upvotes: 14

Related Questions