© 1999-2048 dssz.net 粤ICP备11031372号
[其它] Python基础学习——类与对象2
说明:class BoyFriend: # 类属性 weight=140 money="500万" def __init__(self,name,height):#初始化函数(实例方法) self.name=name self.height=height # 类方法/函数 【自动给补齐了一个self self是实例本身 固定的占位符】 def cooking(self):#会做饭 #实例方法 prin<weixin_38702110> 上传 | 大小:34kb