filmov
tv
Python - Get Object Attributes With a Dir Function
![preview_player](https://i.ytimg.com/vi/Fov2yAnUdV0/maxresdefault.jpg)
Показать описание
#Python #Shorts
Sometimes, especially when working with other people's code, it may be nice to have a list of all class attributes (or properties). Python makes it really easy once again to accomplish this goal. All we need to do is call the built-in "dir" method on an instance of a class, and voila, we get the whole list of attributes.
-------------------------------------------------------------------------------------
Links:
Sometimes, especially when working with other people's code, it may be nice to have a list of all class attributes (or properties). Python makes it really easy once again to accomplish this goal. All we need to do is call the built-in "dir" method on an instance of a class, and voila, we get the whole list of attributes.
-------------------------------------------------------------------------------------
Links: