Python类与对象 Python类与对象易忘点参考链接 目录: Python类与对象易忘点 __init()__方法 使用元类,type()和metaclass type() metaclass(元类) __init()__方法注意:两个下划线,类似Java的构造器函数 实例: class Student(object): def __init__(self, name, score): 2022-04-15 Python #OOP
Python可变参数与关键字参数 可变参数和关键字参数Variable Parameter & Keyword Argument 参考: 简书 廖大 可变参数:实例: def calc(*numbers): sum = 0 for n in numbers: sum = sum + n * n return sum 定义函数cala(),*numbers即为可变参数,在函数内部 2022-04-14 Python