Home > Backend Development > Python Tutorial > What are the Python annotation methods?

What are the Python annotation methods?

烟雨青岚
Release: 2020-06-10 11:53:06
Original
5131 people have browsed it

What are the Python annotation methods?

Python is a cross-platform computer programming language. It is a high-level scripting language that combines interpretation, compilation, interactivity and object-oriented. It was originally designed for writing automated scripts (shells). As the version is constantly updated and new language features are added, it is increasingly used for the development of independent, large-scale projects.

Comments: Contents that are not executed by the machine, comments are generally written in natural language.

Python comment method:

① Line comment: starts with a hash (#) number, which can be a separate line or in a certain line of code Behind .

# 这是打印hello world
print('hello wordl') # 这是打印hello world
Copy after login

② Block comments: Several lines of code or content, starting and ending with three consecutive single quotes or double quotes, any content in between will be ignored by the machine.

Example 1: Three consecutive single quotes starting and ending.

'''
注释。。。
 这是打印hello world 
注释。。。
'''
print("hello wordl")
Copy after login

Example 2: Three consecutive double quotes starting and ending.

""" 
注释。。。 
这是打印hello world
注释。。。
"""
print("hello wordl")
Copy after login

Related recommendations: "Python Tutorial"


The above is the detailed content of What are the Python annotation methods?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template