Home>Article>Backend Development> What symbols are used for single-line comments in Python?

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

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-06-26 15:24:33 8168browse

Comments are explanations and descriptions of a piece of code, which can improve the readability of program code and allow people to understand the code more easily. Especially in large-scale project development and team projects, comments are essential!

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

Any programming language is indispensable for comments, and Python is no exception. The following is the specific usage of single-line comments in Python:

Related recommendations: "Python Video Tutorial

Single-line comments in the Python programming language often start with #. Single-line comments can be placed as a separate line above the line of code being commented, or after a statement or expression.

Example:

# -- coding: UTF-8 --

print (“hello world!”); #Hello, world

The above is the detailed content of What symbols are used for single-line comments in Python?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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