If you don’t like the mentioned solution above, you can use the triple-quote trick to make a block of Python code not run. Command + K then Command + U if you’re on a Mac.If the P圜harm IDE is used to write Python code select multiple code. There are two ways to solve this: Disadvantage of this way is that such comment remains constant string and processed in finished code. Ctrl + K then Ctrl + U if you’re on Windows Python language has no internal multiline comment syntax (like in other languages).
To uncomment a block of code, use your mouse to select it and then use the key combination: pycharm comment multiple lines shortcut is not work commenting more than one line in python pycharm python comment out multiple lines how to comment several lines. Command + K then press Command + C if you’re on a Mac.Ctrl + K then press Ctrl + C if you’re using Windows.All you need to do is select that code block with your mouse, then press the following key combination: Advertisements Solutionįortunately, if you use Visual Studio Code, commenting a block of code is really quick and easy. If a block of code had hundreds of lines, it would be terrible. This is also the default-viewing mode for all Jupyter notebooks in P圜harm. The split view mode lets you both add cells and preview their output. This allows adding and editing notebook cells. To comment on a block of code in Python, you will have to prefix it with # line by line. P圜harm offers three viewing modes to edit your Jupyter notebook files: 1. So how to comment out a block of code in Python? If you have worked with some other programming language like Javascript, Dart … then you will be familiar with / * * / syntax. To comment out a line of code in Python, you can add a # before that line.