Home >Backend Development >Python Tutorial >Why are comments generally colored in python?

Why are comments generally colored in python?

(*-*)浩
(*-*)浩Original
2019-08-02 10:22:226885browse

Comments in Python include single-line comments and multi-line comments:

Why are comments generally colored in python?

Single-line comments in Python start with #, for example: (Recommended learning: Python video tutorial)

For single-line comments, just use a #, and the commented text is displayed in red (different editors display different colors)

# 创建字典

As shown in the picture:

Why are comments generally colored in python?

Use three single quotes for multi-line comments. Be careful to use three single quotes at the beginning of the comment, and at the same time The text of the annotation is displayed in green (different editors display different colors)

'''
多行注释
多行注释
多行注释
'''    
print("ok")

As shown in the picture:

Why are comments generally colored in python?

More Python related technologies Article, please visit the Python Tutorial column to learn!

The above is the detailed content of Why are comments generally colored 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
Previous article:How to open python shellNext article:How to open python shell