上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: pycharm 不显示代码提示 1、检查是否代码本身有问题。 2、检查代码提示是否成功开启。 setting → Inspections → Spelling 要开启 setting → Inspections → Python 要打开 3、检查IDE省电模式是否关闭状态!!! file → pow 阅读全文
posted @ 2020-02-13 16:06 i勤能补拙 阅读(1586) 评论(0) 推荐(0) 编辑
摘要: 第一类单继承的实现:from person import Personfrom student import Studentfrom worker import Workerper = Person("aa", 1, 2)stu = Student("tom", 18, 12345, 110)pri 阅读全文
posted @ 2020-02-13 15:16 i勤能补拙 阅读(503) 评论(0) 推荐(0) 编辑
摘要: class Person(object): def run(self): print(self.__money) print("run") def eat(self, food): print("eat " + food) def __init__(self, name, age, height, 阅读全文
posted @ 2020-02-10 21:22 i勤能补拙 阅读(236) 评论(0) 推荐(0) 编辑
摘要: '''重写:将函数重写定义写一遍__str__():在调用print打印对象时自动调用,是给用户用的,是一个描述对象的方法。__repr__():是给机器用的,在Python解释器里面直接敲对象名在回车后调用的方法注意:在没有str时,且有repr,str = repr'''class Person 阅读全文
posted @ 2020-02-10 20:53 i勤能补拙 阅读(843) 评论(0) 推荐(0) 编辑
摘要: '''析构函数:__del__() 释放对象是自动调用'''class Person(object): def run(self): print("run") def eat(self, food): print("eat " + food) def __init__(self, name, age 阅读全文
posted @ 2020-02-10 20:27 i勤能补拙 阅读(711) 评论(0) 推荐(0) 编辑
摘要: '''self代表类的实例,而非类哪个对象调用方法,那么该方法中的self就代表那个对象self.__class__ 代表类名_'''class Person(object): def run(self): print("run") print(self.__class__) p = self.__ 阅读全文
posted @ 2020-02-10 17:02 i勤能补拙 阅读(2287) 评论(0) 推荐(0) 编辑
摘要: class Person(object): #name = "stu" #age = 10 #height = 160 #weight = 90 def run(self): print("run") def eat(self, food): print("eat " + food) def __i 阅读全文
posted @ 2020-02-10 11:17 i勤能补拙 阅读(1445) 评论(0) 推荐(0) 编辑
摘要: class Person(object): name = "stu" age = 10 height = 160 weight = 90 def run(self): print("run") def eat(self, food): print("eat " + food) def openDoo 阅读全文
posted @ 2020-02-10 11:14 i勤能补拙 阅读(2113) 评论(0) 推荐(0) 编辑
摘要: class Person(object): name = "" age = 0 height = 0 weight = 0 def run(self): print("run") def eat(self, food): print("eat" + food) def openDoor(self): 阅读全文
posted @ 2020-02-09 21:29 i勤能补拙 阅读(406) 评论(0) 推荐(0) 编辑
摘要: '''设计类类名:见名之意,首字母大写,其他遵循驼峰原则属性:见名之意,其他遵循驼峰原则行为(方法/功能):见名之意,其他遵循驼峰原则类名:Wife属性:sex age height weight faceValue行为:做饭 洗衣服 拖地 揉肩 捶腿类名:Husband属性:sex age hei 阅读全文
posted @ 2020-02-09 21:27 i勤能补拙 阅读(2258) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页