How python annotates multiple lines of code
Most people don't understand the knowledge points of this article "how python annotates multi-line code", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "how python annotates multi-line code".
single-line comments
Using #as a comment character, peer code following #is commented out.
#This is a comment print("Hello, World")#Text and code after the comment character will not be executed
This annotation method is the main annotation method, which can be used to annotate a single line of code to facilitate debugging by developers.
multiline comments
Comment with three single quotes or three double quotes. Anything between quotes is not executed.
This type of comment is mainly used to comment a large piece of text, and it is more convenient when commenting a large piece of code.
print("Hello, World! ") ''' This is a multiline comment, with three single quotes. This is a multiline comment, with three single quotes. This is a multi-line comment, with three single quotes ''print("Hello, python! ") """ This is a multi-line comment, with three double quotes This is a multi-line comment, with three double quotes This is a multi-line comment, with three double quotes """ print("Hello, pycharm! ")
Quick comments for common editors
When editing python code using vscode, pycharm, you can use Ctrl +/to comment on the selected area.
When editing python code using IDLE, you can use Alt+3 to comment on the selected code and Alt+4 to remove comments on the selected code.
The above is the content of this article about "how python annotates multi-line code". I believe everyone has a certain understanding. I hope the content shared by Xiaobian will be helpful to everyone. If you want to know more relevant knowledge, please pay attention to the industry information channel.