python基础学习第二弹类属性和实例属性

代码如下:

#!/usr/bin/env python class foo(object): x=1 if __name__==’__main__’: foo = foo() print ‘foo.x=’,foo.x print ‘foo.x=’,foo.x foo.x = 2 print ‘foo.x=’,foo.x print ‘foo.x=’,foo.x

Posted in 未分类