>>> class Person(object):
... #this is method
... def personMethod(self):
... pass
...
以上,#this is method就是局部注释。
在函数、类或者文件开头的部分写文档字符串说明,一般采用三重引号。这样写的最大好处是能够用 help() 函数看。
"""This is python lesson"""
def start_func(arg):
"""This is a function."""
pass
class MyClass:
"""Thi is my class."""
def my_method(self,arg):
"""This is my method."""
pass