Is there a function in the Python language (v3.6) to display attributes and methods of an object, such as console.dir()
in JavaScript?
I'd like to get output similar to console.dir
in web browsers.
The dir
function of Python has a "messy" middle return, where a text denoting an array is returned, which does not tell what method it is and what it is, except that this return is in the same text style, and I I would like each line to contain only one method / attribute, making it easier to understand and not get lost.
Exemplifying: In a scenario where an object manages / represents employees:
Fictitious Attributes and Methods:
- Resign: method
- Hire: method
- Officials: attribute
As the dir
function of Python returns:
['demitir', 'contratar', 'funcionarios']
How I would like it to return (more or less):
{
'demitir':'function...',
'contratar':'function...',
'funcionarios': 20
}
I'm open to suggestions from third-party libraries / resources. I do not need it to be native, I just need it to work more or less as I described it. Thank you.