在Python的IDLE中一次将缩进添加到多行 [英] Adding indentation to multiple lines at once in Python's IDLE
问题描述
我已经写了很多行代码,现在改变了主意. (我想将所有这些行放入"while"循环中.)
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?
推荐答案
在 Sublime Text 中,突出显示文本并按 TAB (或 SHIFT + TAB 进行相反的操作,即删除一个缩进级别). 这与在每一行的开头添加标签相同.
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.
这些快捷方式在其他几个文本编辑器中是相同的,例如记事本++,Eclipse甚至是Word.
These shortcuts is the same in several other text editors, e.g. Notepad++, Eclipse and even Word.
其他编辑者可能会使用其他/其他快捷方式,例如中的 CTL + ] 或 CTL + []中的.
Other editors may use different/additional shortcuts e.g. in CTL+] or CTL+[) in IDLE (and Sublime Text).
这篇关于在Python的IDLE中一次将缩进添加到多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!