Changing indentation in Python's IDLE

2019-08-31 00:22发布

I have written many lines of code already, and have now changed my mind on their indentation. (I want to put all of these lines into a 'while' loop.)

For each line, I could press the space button or tab, but this would take a long time.

Can I add the appropriate indentation/margin to all these lines at once?

1条回答
ら.Afraid
2楼-- · 2019-08-31 01:16

In Sublime Text, highlight text and press TAB (or SHIFT+TAB to do the opposite i.e. remove one level of indentation). This will do the same as adding a tab at the beginning of every line.

These shortcuts is the same in several other text editors, e.g. Notepad++, Eclipse and even Word.

Other editors may use different/additional shortcuts e.g. in CTL+] or CTL+[) in IDLE (and Sublime Text).

查看更多
登录 后发表回答