Annotation method in Python code

Single line comment

Single-line comment use**#** No. for comment

# hello world

Multi-line comments

Python actually has no syntax for multi-line comments. Since Python will ignore string literals that are not assigned to variables , you can add multiple lines of strings (triple quotes) to the code and add comments in them.

"""hello, world"""
'''hello, world'''

Previous Next

Guess you like

Origin blog.csdn.net/wzc18743083828/article/details/108898770