Annotations are very important in the program. They can be used to describe the code and temporarily invalidate some code. Let's see how to use Annotations:
[Python]
1. #-*-coding: UTF-8 -*-
2. # This is a comment.
3. # Anything after # is ignored by python.
4.
5.
6. print "I cocould have code like this." # this will also be ignored.
7.
8.
9. # You can also use # to invalidate the code
10. # print "This won't run ."
11.
12.
13. print "This will run ."
The first sentence must be added to the Chinese comments. There may be a question:
The first sentence also begins with #. Why does it play the role of setting encoding?
It can only be said that this is a habit of writing, used to set the file encoding method, does not affect the running of the program.
After running:
Root @ he-desktop :~ /Mystuff # python ex2.py
I cocould have code like this.
This will run.
Root @ he-desktop :~ /Mystuff #
Extra score exercise
1. Remember and figure out the role and pronunciation.
The general Chinese reading well number.
2. Check your program from the back.
3. Have you found any errors? If yes, correct it. Www.2cto.com
4. Read your program and see if there are any errors? If yes, correct it.
Read to ensure that annotations can be understood, I think.
Author: lixiang0522