随笔分类 -  Python编程

摘要:在Python的使用中,我们经常会遇到这样的函数定义: def my_func(x, y, *args, **kwargs): for arg in args: print(arg) for key, value in kwargs.items(): print(f"{key}: {value}") 阅读全文
posted @ 2023-04-10 11:00 iSherryZhang 阅读(199) 评论(0) 推荐(0)
摘要:Python类 Python类的设计原则 封装(Encapsulation):Python类被设计用来将相关数据和行为封装到一个独立的单元中。 继承(Inheritance):Python支持继承,允许子类从父类继承属性和方法。有利于代码的复用和创建相关类的层次结构。 多态(Polymorphism 阅读全文
posted @ 2023-04-06 17:48 iSherryZhang 阅读(613) 评论(0) 推荐(2)