本文实例讲述了python访问类中docstring注释的实现方法。分享给大家供大家参考。具体分析如下:
python的类注释是可以通过代码访问的,这样非常利于书写说明文档
class Foo: passclass Bar: """Representation of a Bar""" passassert Foo.__doc__ == Noneassert Bar.__doc__ == "Representa<strong>本文来源gao@daima#com搞(%代@#码网</strong>tion of a Bar"
希望本文所述对大家的Python程序设计有所帮助。