代码如下:
#!/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
A programmer’s note boke for work and life
代码如下:
#!/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