1
2
3
4
5
6
7
8
9
10
11
12
13
|
class ren( object ):
'''this class is about ren class。类的说明,使用三个单引号'''
name = '菇凉'
sex = 'Female'
def hello( self ):
print ( 'hello world' )
a = ren()
print ( type (a))
print (a.name)
print (a.sex)
a.hello() a.name = '未来啊'
print (a.name)
|
返回结果:
<class '__main__.ren'>
菇凉
Female
hello world
未来啊
本文转自 归来仍少年 51CTO博客,原文链接:http://blog.51cto.com/shaoniana/1980560