In python, methods and classes can be folded, but in many cases, a part of the code needs to be folded according to the implemented function.
It can be implemented with the same comment code:
#< editor-fold desc="What to display after folding"'''
your code
'''
#< /editor-fold
Very simple two sentences, but there was a problem the first time I used it, because I had already completed the code, so I wrote these two sentences on the front and back ends respectively, and the result could not be folded...
At first I thought it was a misspelling, and I checked it several times, to no avail.
Finally, after writing these two lines next to each other, cut the code to be folded to the middle, everything is OK...
I think it should be a bug in the IDE. I use PyCharm 2016.3
Supplementary knowledge: Pycharm folding code shortcut keys
Desktop Eclipse shortcut keys
All code folding: ctrl+alt+-
All code expansion: ctrl+alt++
Collapse a certain point: ctrl+-
Expand a layer: ctrl++
postscript:
The above Python implementation code block folding is all the content shared by the editor, I hope to give you a reference.
Recommended Posts