How do I look inside a Python object?

Python has a strong set of following built-in functions to collect information about the attributes, properties and methods of any python object −

  • type()

  • dir()

  • id()

  • getattr()

  • hasattr()

  • globals()

  • locals()

  • callable()

type() and dir() are particularly useful for finding the type of an object and its set of attributes, respectively.