- #!/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
- #该片段来自于http://www.codesnippet.cn/detail/050620133822.html
来源: http://www.codesnippet.cn/detail/050620133822.html