Hello everyone, let me share with you an interesting thing. Many people don’t know this yet. Let’s explain it in detail below. Now let’s take a look!
1. Python single-line comment symbol (#)
Single-line comments in python start with #
Example: #this is a comment
2. Batch and multi-line comment symbols
Multi-line comments are enclosed in triple quotes, for example:
Enter ''' ''' or """ """ and insert the code to be commented in the middle
3. The comment shortcut key of IDLE under Windows is Alt+3, and the uncomment key is Alt+4.
4. python Chinese annotation method
When I was writing a script today, I got an error: SyntaxError: Non-ASCII character '\xe4' in file getoptTest.py on line 14, but no encoding declared; see http://www.python.org/peps/pep-0263. Html for details
If there are non-ASCII characters in the file, you need to specify the encoding statement on the first or second line. Change the encoding of the ChineseTest.py file to ANSI and add the encoding statement:
Be sure to add this sentence on the first or second line: #coding=utf-8
Or # -*- coding: utf-8 -*-
Address of this article: http://itbyc.com/Python/21475.html
Please indicate the source for reprinting the usage of python for statement .