class A():
def __init__(self):
self.a = 1
self.b = 2
def aa(self):
print('i am ok')
cl = A()
print(cl.__dict__)
# {'a': 1, 'b': 2}
print(dir(cl))
#[....'__subclasshook__', '__weakref__', 'a', 'aa', 'b']
print(help(cl))
python 查看类的属性和方法
最新推荐文章于 2024-05-06 15:38:32 发布