当前位置:网站首页>2. # code comments
2. # code comments
2022-08-01 03:07:00 【Andy Python】
2. Python # 代码注释
1. 什么是代码注释
Code comments are comments on the code.
It is equivalent to annotating a Chinese definition for an English word.
【温馨提示】注释是给程序员自己看的,will not be executed by the computer.
【示例】
# 用printThe function outputs an integer
print(520)
520
上述代码中的第1行是注释,to explain the2行代码.
2. 注释语法
A one-line comment statement usually consists of 4部分组成:
1.#
2.空格
3.注释内容
4.注释位置
【解析】

1.#是注释符号,at the beginning of a comment line;
2.#后面有一个空格,The spaces are there to make the comments look nicer;
3.Write comments;
4.Comments can be on the previous line of code,Also at the end of the code.

3. 注释位置
1. The comment is on the previous line of the code
# 用printThe function outputs an integer
# Note that parentheses should be used in English parentheses
print(520)
【终端输出】
520
2. Comments are at the end of the code
print(520) # 用printThe function outputs an integer
【终端输出】
520
4. 课堂练习
自己动手用print( )The function outputs today's date,and write a line comment for it.
边栏推荐
- Device tree - conversion from dtb format to struct device node structure
- 【uniCloud】云对象的应用与提升
- gateway gateway cross domain
- After specifying set 'execution.savepoint.path', restart flinksql and report this error
- Game Security 03: A Simple Explanation of Buffer Overflow Attacks
- leetcode6133. 分组的最大数量(中等)
- Unity3D study notes 10 - texture array
- 树莓派 的 arm 版的 gcc 安装 和环境变量的配置
- 787. Merge Sort
- test
猜你喜欢

button去除黑框

MYSQL two-phase commit

second uncle

预言机简介

How to get started with YOLO?How to implement your own training set?

Unknown Bounded Array

Flink deploys and submits jobs

Unity3D study notes 10 - texture array

JS new fun(); 类与实例 JS基于对象语言 只能通过书写构造函数充当类

Open source project site must-have & communication area function
随机推荐
pdb drug comprehensive database
785. 快速排序
解决安装MySQL后,Excel打开很慢的问题
MySQL修改SQL语句优化性能
一个service层需要调用另两个service层获取数据,并组装成最后的数据,数据都是list,缓存如何设计?
[uniCloud] Application and Improvement of Cloud Objects
HCIP(15)
The fledgling Xiao Li's 113th blog project notes: Wisdom cloud smart flower watering device combat (2) - basic Demo implementation
Basic use of vim - command mode
win10 fixed local IP
初出茅庐的小李第114篇博客项目笔记之机智云智能浇花器实战(3)-基础Demo实现
高维高斯分布基础
win10 固定本机IP
Simple vim configuration
"Youth Pie 2": The new boyfriend stepped on two boats, and the relationship between Lin Miaomiao and Qian Sanyi warmed up
Replacing the Raspberry Pi Kernel
《少年派2》:新男友竟脚踩两只船,林妙妙与钱三一感情回温
在打开MYSQL表时,有的可以显示编辑,有的没有,如何设置。
Chain programming, packages, access
High dimensional Gaussian distribution basics