Python语法随手记


class demo(object):
    def __init__(self):
        self.id = 1
        self.name = 'abc'
        self.age = 16


if __name__ == '__main__':
    print(type(demo.__dict__))
    # 
    print(demo.__dict__)
    # {'__module__': '__main__', '__init__': , '__dict__': , '__weakref__': , '__doc__': None}
    print(type(demo().__dict__))
    # 
    print(demo().__dict__)
    # {'id': 1, 'name': 'abc', 'age': 16}

你可能感兴趣的:(Python语法随手记)