python类的简单使用
class Person: def __init__(self, name , age): self.name = name self.age = age def print_name(self): print("my name is %s"%self.name) def print_age(self): print("my age is {}".format(self.age)) pTest = Person("Bob", "25") print("这是类实例化后的内存地址:%s"%pTest) pTest.print_name() pTest.name = "Make" pTest.print_age()