Home > Backend Development > Python Tutorial > python 基础学习第二弹 类属性和实例属性

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 11:27:21
Original
1188 people have browsed it

代码如下:


#!/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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template