Indentation in python GUI

As i write code in python and suddenly feel like adding a new block in front of the code i have already written.... the indentation of the complete code is affected.. it is very tedious process to move to each line and change the indentation...is there any way to do auto indent or something...

eg:

def somefunction:
     x =5
     return x

if i want to add a contrl block

eg:

def somefunction:
     if True:
         x =5
         return x
     return 0

this small change of adding a control block took a lot of tab work....

is there a shortcut or sumthing to do this easily?


I don't know what wacky planets everyone is coming from, but in most editors that don't date back to the stone age, indenting blocks of code typically only requires that a block of text be selected and Tab be pressed. On the flip side, Shift+Tab usually UNdents the block.

This is true for Visual Studio, Notepad2, e, Textmate, Slickedit, #Develop, etc. etc. etc.

If you're not doing large multi-file projects, I strongly recommend Notepad2. Its a very lightweight, free, easy-to-use notepad replacement with just enough code-centric features (line numbers, indentation guides, code highlighting, etc.)


In the Idle editor, you can just select the lines you want to indent and hit Tab.

I should note that this doesn't actually insert any tabs into your source, just spaces.


在IDLE中,我只是使用ctrl +]和ctrl + [在代码块上。

链接地址: http://www.djcxy.com/p/28624.html

上一篇: 我如何在vim中排除代码块?

下一篇: 在python GUI中缩进