Quickly turn multiple lines into comments in Python
This article was co-authored by wikiHow staff writer, Kyle Smith. Kyle Smith is a wikiHow Technology Writer, learning and sharing information about the latest technology. He has presented his research at multiple engineering conferences and is the writer and editor of hundreds of online electronics repair guides. Kyle received a BS in Industrial Engineering from Cal Poly, San Luis Obispo.
This article has been viewed 2,994 times.
Learn more...
Trying to comment out a block of code in Python? There are multiple easy methods to do so! You can use the hash character # or turn the lines into a string. The keyboard shortcut for turning lines into code varies depending on the text editor you’re using. This wikiHow shows you how to comment out multiple lines in Python.
Things You Should Know
- Place a # and a space before each line of code.
- Alternatively, place """ before and after the block of code.
- To use a keyboard shortcut, select the block of code, then press the key combination.