Python入门篇之面向对象(7)
class TestClassMethod: @classmethod def foo(cls): print 'calling class method foo()' print 'foo() is part of class:', cls.__name__
>>> class TestClassMethod:
@classmethod
def foo(cls):
print 'calling class method foo()'
print 'foo() is part of class:', cls.__name__
- 上一篇:python3生成随机数实例
- 下一篇:Python入门篇之数字
精彩图集
精彩文章