How do I look inside a Python object?

Python has a strong set of introspection features.

Take a look at the following built-in functions:

  • type()
  • dir()
  • id()
  • getattr()
  • hasattr()
  • globals()
  • locals()
  • callable()

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)