首页 > 其他 > 详细

8.1 类的一般形式

时间:2017-11-10 12:36:09      阅读:247      评论:0      收藏:0      [点我收藏+]
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

未来啊


8.1 类的一般形式

原文:http://shaoniana.blog.51cto.com/11471609/1980560

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!