当前位置:网站首页>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.
边栏推荐
- Lua introductory case of actual combat 1234 custom function and the standard library function
- [Getting Started Tutorial] Rollup Module Packager Integration
- 预言机简介
- MySQL修改SQL语句优化性能
- HCIP (14)
- The kernel of the decompression process steps
- The IDEA can't find or unable to load The main class or Module "*" must not contain The source root "*" The root already belongs to The Module "*"
- how to edit the table of contents of an epub ebook
- Basic implementation of vector
- Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
猜你喜欢

Unknown Bounded Array

The fledgling Xiao Li's 112th blog project notes: Wisdom cloud intelligent flower watering device actual combat (1) - basic Demo implementation

Flink deploys and submits jobs

设备树——dtb格式到struct device node结构体的转换

北京突然宣布,元宇宙重大消息

How is the tree structure of the device tree reflected?

IDEA debugging

This map drawing tool is amazing, I recommend it~~

MYSQL Classic Interview Questions

项目越写越大,我是这样做拆分的
随机推荐
从设备树(dtb格式数据)中解析出bootargs
黑客到底可以厉害到什么程度?
IDEA调试
测试
By CSDN, torn
MySQL修改SQL语句优化性能
解决安装MySQL后,Excel打开很慢的问题
Chinese version of Pylint inspection rules
被 CSDN,伤透了心
Data Middle Office Construction (VII): Data Asset Management
IDEA does not recognize the module (there is no blue square in the lower right corner of the module)
HCIP(15)
修改Postman安装路径
Game Security 03: A Simple Explanation of Buffer Overflow Attacks
[SemiDrive source code analysis] series article link summary (full)
sqlserver cannot connect remotely
[Search topic] After reading the inevitable BFS solution to the shortest path problem
指定set 'execution.savepoint.path'后,重启flinksql报这个错是啥
[Data analysis] Based on matlab GUI student achievement management system [including Matlab source code 1981]
带你体验一次类型编程实践