How do I look inside a Python object?

PythonServer Side ProgrammingProgramming

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.

raja
Published on 23-Jan-2018 13:58:07
Advertisements