As mentioned in most previous answers, the way to use dir(), id() and even vars() is complex.
Another alternative is the pyobject library that combines many features in other modules including squiz, ppretty, objbrowser and even internal bytecodes, all in one:
>>> import sys,os
>>> from pyobject import desc, browse
>>> desc(sys.version_info)
sys.version_info(major=3, minor=7, micro=8, releaselevel='final', serial=0):
count: <built-in method count of sys.version_info object at 0x01349600>
index: <built-in method index of sys.version_info object at 0x01349600>
major: 3
micro: 8
minor: 7
n_fields: 5
n_sequence_fields: 5
n_unnamed_fields: 0
releaselevel: 'final'
serial: 0
>>> search(os, sys, recursions=3)
["sys.modules['site'].os", "sys.modules['os']", "sys.__interactivehook__.__globals__['os']", "sys.modules['__main__'].os",...]
>>> browse(sys) # This will browse the object in a GUI
On Ubuntu:
Note: I'm the developer of pyobject.