简体   繁体   English

在记事本中折叠不缩进的python代码

[英]Collapsing nonindented python code in notepad++

I am using notepad++ for wiring python code. 我正在使用notepad ++连接python代码。 For indented code it is possible to click the minus sign on the left side to minimize that section. 对于缩进的代码,可以单击左侧的减号以最小化该部分。 For example, commands that require a indent (ie if/def/while commands) can easily be minimized down. 例如,需要缩进的命令(即if / def / while命令)可以轻松地最小化。 I however have blocks of code that are all at the same indentation level that I would also like to minimize [ie be able to specify my own levels]. 但是,我的代码块都处于相同的缩进级别,因此我也希望将其最小化(即能够指定自己的级别)。 Given Python has specific rules for indentation, I can't see an obvious way of forcing a break. 鉴于Python具有缩进的特定规则,我看不出强制中断的明显方法。 Just wondering if there is ideally a 'clean' way of achieving this, or if not, a simple way to force it. 只是想知道是否有一种理想的“干净”方式来实现这一目标,或者如果没有,那就是一种简单的方式来实现它。

In Notepad++ you can select code then right click and at the bottom of the menu you can select "hide lines" this may help it may not, but its just something that can help you hide code that you know works and you don't need to see any more. 在Notepad ++中,您可以选择代码,然后单击鼠标右键,然后在菜单底部可以选择“隐藏行”,这可能不会有所帮助,但这只是可以帮助您隐藏已知有效且不需要的代码而已。看更多。 You can easily see the code again by clicking one of the 2 small arrows that are shown on the left hand side where the code would of been located. 通过单击左侧将显示代码所在的2个小箭头之一,您可以轻松地再次查看该代码。 (Note: There is also a keyboard shortcut for this, just select the code then hit Alt + H ) (注意:还有一个键盘快捷键,只需选择代码,然后按Alt + H即可

Hope this Helped, 希望这有所帮助,

~Bobbeh 〜波贝

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM