What symbols are used for single-line comments in Python code

angryTom
Release: 2020-02-11 11:19:23
Original
16722 people have browsed it

There are many kinds of comments in python, including single-line comments, multi-line comments, batch comments, and Chinese comments are also commonly used. Python comments also have their own specifications. This article will introduce single-line comments in Python.

What symbols are used for single-line comments in Python code

What symbols are used for single-line comments in Python code

Use the pound sign "#" for single-line comments.

Python uses the pound sign (#) to indicate the beginning of a single-line comment. Code following the "#" sign until the end of the line will be ignored by the interpreter.

A single line comment is to comment a line of code in the program. In a Python program, just put the pound sign (#) before the content that needs to be commented. The content to the right of

print(1) #输出1
Copy after login

# will not be output during execution.

Execution result:

1
Copy after login

Recommendation:Python tutorial

The above is the detailed content of What symbols are used for single-line comments in Python code. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template