How do I block comment in Jupyter notebook?
I have not yet managed to find the best way possible. Since I am using a keyboard with Finnish
layout, some of the answers do not work for me (e.g. user5036413's answer).
However, in the meantime, I have come up with a solution that at least helps me not to comment each and every line one by one. I am using Chrome browser
in MS Windows
and I have not checked other possibilities though.
The solution:
It uses the fact that you can have multiple line cursors in an Ipython Notebook
.
Press the Alt button and keep holding it. The cursor should change its shape into a big plus sign. The next step is, using your mouse, to point to the beginning of the first line you want to comment and while holding the Alt button pull down your mouse until the last line you want to comment. Finally, you can release the Alt button and then use the #
character to comment. Voila! You have now commented multiple lines.
Ctrl + / works for me in Chrome browser in MS Windows. On a Mac, use Cmd + / (thanks Anton K).
Please note, if /
did not work out of the box, try pressing the /
key on the Numpad. Credit: @DreamFlasher in comments to this question.