ZhangZhihui's Blog  
上一页 1 ··· 59 60 61 62 63 64 65 66 67 ··· 116 下一页

2024年7月31日

摘要: There are many built-in functions and methods that return iterables and iterators. Here are a few examples: range() returns an iterable dict.keys() re 阅读全文
posted @ 2024-07-31 09:43 ZhangZhihuiAAA 阅读(20) 评论(0) 推荐(0)
 
摘要: class Engine: def __init__(self,power): self.power = power def start(self): self.draw_current() self.spin() self.ignite() def draw_current(self): prin 阅读全文
posted @ 2024-07-31 09:34 ZhangZhihuiAAA 阅读(16) 评论(0) 推荐(0)
 
摘要: We have seen that if we have to define a group of classes that have similar features and show common behavior, we can define a base class and then inh 阅读全文
posted @ 2024-07-31 09:30 ZhangZhihuiAAA 阅读(23) 评论(0) 推荐(0)
 
摘要: The three main features of object-oriented programming are - encapsulation, inheritance and polymorphism. We have seen the first two, now let us see w 阅读全文
posted @ 2024-07-31 09:19 ZhangZhihuiAAA 阅读(34) 评论(0) 推荐(0)

2024年7月30日

摘要: The order in which Python searches for attributes in base classes is called method resolution order(MRO). It gives a linearized path for an inheritanc 阅读全文
posted @ 2024-07-30 22:07 ZhangZhihuiAAA 阅读(54) 评论(0) 推荐(0)
 
摘要: The magic methods __str__ and __repr__ are used for converting an instance object into a string. The method __str__ is invoked when an instance object 阅读全文
posted @ 2024-07-30 20:42 ZhangZhihuiAAA 阅读(21) 评论(0) 推荐(0)
 
摘要: Creating Managed Attributes using properties Properties can be used to create data attributes with special functionality. If you want some extra funct 阅读全文
posted @ 2024-07-30 18:55 ZhangZhihuiAAA 阅读(24) 评论(0) 推荐(0)
 
摘要: Sometimes we have to write methods that are related to the class but do not need any access to instance or class data for performing their work. These 阅读全文
posted @ 2024-07-30 18:29 ZhangZhihuiAAA 阅读(43) 评论(0) 推荐(0)
 
摘要: Class methods allow us to define alternative initializers (also known as factory methods) in a class. These methods help us create instance objects fr 阅读全文
posted @ 2024-07-30 16:32 ZhangZhihuiAAA 阅读(37) 评论(0) 推荐(0)
 
摘要: os.getcwd() Returns the path of the current working directory os.chdir(path) Changes our current working directory 阅读全文
posted @ 2024-07-30 15:49 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)
上一页 1 ··· 59 60 61 62 63 64 65 66 67 ··· 116 下一页