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

What are the Python annotation methods?

烟雨青岚
烟雨青岚Original
2020-06-10 11:53:065012browse

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

② 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")

Example 2: Three consecutive double quotes starting and ending.

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

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!

Statement:
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