Search code examples
pythonintellij-ideareplacepycharmcomments

PyCharm comment print lines


Is there any shortcut in the IntelliJ IDE such as PyCharm to comment all the lines start with 'print'?

Since during the debug I always write many prints, after the code runs well I want to find a convenient way to comment on all lines starting with 'print'. Now I select each line/block with command + / which is trouble.


Solution

  • Not sure about pycharm, but I guess you could use find/replace with a regex like '^print' and substitute with '# print'. Maybe you can even make this a macro / Hotkey in pycharm.