>>> class a(object):
    pass
>>> o=a()
>>> dir(o)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']

>>> o.__class__#对象的类属性指向类对象
<class '__main__.a'>
>>> type(o.__class__)
<type 'type'>
>>> o.__class__.__name__  #a类名字

相关文章:

  • 2021-10-22
  • 2022-12-23
  • 2021-10-29
  • 2021-11-29
  • 2021-07-09
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
猜你喜欢
  • 2023-03-19
  • 2022-12-23
  • 2022-01-17
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案