Search code examples
google-colaboratoryshortcutcomments

Is it possible to do block-comments in Google Colab?


In Jupyter Notebook, you can toggle/comment a block of selected code with Ctrl + /, but this doesn't work in Google Colaboratory notebooks. Is there a way to comment out several lines of Python code easily in a Colaboratory notebook?

I've looked in the documentation, but I came up short.


Solution

  • In the default Colab keyboard shortcuts, you can block comment text using Ctrl+/.

    If this does not work for you, check Tools->Keyboard Shortcuts and search for "Comment Current Line" to see what the shortcut is within your current settings.