首页 > 学院 > 开发设计 > 正文

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

2019-11-14 17:26:02
字体:
来源:转载
供稿:网友

demo

#!/usr/bin/pythonclass Person:    name = 'jim'    age = 25    def say(self):        PRint 'My name is ' + self.name + ', and age is ' + str(self.age)p = Person()p.say()print p.name

 


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表