Home >Backend Development >Python Tutorial >Why are comments generally colored in python?
Comments in Python include single-line comments and multi-line comments:
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:
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:
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!