Home > Backend Development > Python Tutorial > How to comment multiple lines in python

How to comment multiple lines in python

清浅
Release: 2019-02-26 13:22:12
Original
107834 people have browsed it

There are three ways to comment multiple lines in Python: use ctrl / to comment multiple lines, use the shift # key at the beginning of each line, enter ''' ''' or """ " "", insert the code to be commented in the middle

We often comment the code in the process of writing code. However, commenting line by line is troublesome. In the following two articles, we will introduce how to comment multiple lines of code in the Python language. It has a certain reference value and I hope it will be helpful to everyone

How to comment multiple lines in python

[Recommended course: Python tutorial]

Multi-line code comment

Method 1: First select the paragraph to be commented, and then press ctrl / to comment multi-line code. The effect is as follows:

How to comment multiple lines in python

Press ctrl / again to uncomment the

How to comment multiple lines in python

method Two: Just like commenting a single line, enter shift

#
 #r+=(i-arr[idx])*rat[idx]
 #print (i-arr[idx])*rat[idx]
 #i=arr[idx]
Copy after login

in front of each line. Method three: You can enter ''' ''' or """ """ to insert the code to be commented. In the middle, you can also achieve the effect of commenting on multiple lines of code

Image 025.png

Summary: The above is the entire content of this article. I hope it will be helpful to everyone learning the Python language. .


The above is the detailed content of How to comment multiple lines in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template