How to comment multiple lines in Python

silencement
Release: 2019-06-20 14:05:56
Original
31579 people have browsed it

There are many kinds of comments in python, including single-line comments, multi-line comments, and Chinese comments are also commonly used. Python annotations have their own specifications. Comments can serve as notes. When working in a team, code written by individuals is often called by multiple people. In order to make it easier for others to understand the flow of the code, using comments is very effective.

How to comment multiple lines in Python

1. Python single-line comments

In Python, single-line comments use the pound sign, written as #.

When the Python program is running, the content after # will not be executed and is treated as a comment

How to comment multiple lines in Python

The output result is I love python, the content after # It is not executed

2. Python multi-line comments

There will also be comments with many lines in python. In this case, multiple lines need to be batched. Comment symbol. Multi-line comments are enclosed in triple quotes ''' '''.

How to comment multiple lines in Python

When using multi-line comments, avoid mixing single quotes and double quotes!

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 Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!