当前位置:首页 > Python教程 > python技巧

python学习笔记十二:类的定义

demo

            #
            !/usr/bin/python
            class
             Person:
    name = jim
    age = 25

    def say(self):
        printMy name is  + self.name + , and age is  + str(self.age)

p = Person()
p.say()
print p.name

 

原文:http://www.cnblogs.com/lurenjiashuo/p/python-note-class.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!