专题文章
时长:00:00更新时间:2020-11-27 14:22:36
实例如下所示。class Person(): def __init__(self.name): self.name = namedef print_name(self): print(self.name)p = Person(';Li';)import typesp.print_name = types.MethodType(print_name.p) # 绑定函数到对象p.print_name()@staticmethoddef print_abc(): print(';abc';)Person.print_abc = print_abcPerson.print_abc()@classmethoddef print_123(cls): print('。
查看详情