Search code examples
python-3.xcomments

How to transform lines of code into a comment in Python3


just wondering how to convert a set of code into comments, without having to go through each individual line of code and put a # at the beginning. Was thinking that maybe there was a quick way to highlight the code and then convert it into comment, atm i'm just cutting it off the code and then re-pasting it in later on.

Much appreciated :)

P.S. i m using Pycharm as my IDE


Solution

  • In jupyter notebook, we select lines of code and press ctrl and / key simultaneously to convert a set of code into comments. Also same for vice versa. You can try it in Pycharm.