How does python view the contents of an object?

an object is known in

python2.7:
< ABC_deploy_mgmt.dashboards.patch.deploy_plane.models.ComputeNode object at 0x49cc7d0 >
this object is returned by a method. Its properties are:
"_ add__","_ class__","_ contains__","_ delattr__","_ delitem__","_ delslice__","_ doc__","_ eq__","_ _ format__", "_ _ ge__","_ _ getattribute__","_ _ getitem__","_ _ getslice__","_ _ gt__","_ _ hash__","_ _ iadd__","_ _ imul__","_ _ init__","_ _ iter__","_ le__","_ len__","_ lt__","_ _ mul__", "_ _ ne__","_ _ new__","_ _ reduce__","_ _ reduce_ex__","_ _ repr__","_ _ reversed__","_ _ rmul__","_ _ setattr__","_ _ setitem__","_ _ setslice__","_ sizeof__","_ str__","_ subclasshook__", "append"," count", "extend"," index", "insert"," pop", "remove"," reverse", "sort"
I want to see the contents of this object. How can I see it? Thank you.

Mar.22,2021

use getattr method, built-in.
python/python-func-getattr.html" rel=" nofollow noreferrer "> http://www.runoob.com/python/.
is worth noting that what you get may be attributes, such as integers, strings, etc., and
may also be callable methods, which can be called (judged by callable (object) , also built-in), of course. Callable methods may require parameters.


if the object has been instantiated, the contents of the object can be obtained through the class's built-in property _ _ dict__. The attribute name and attribute value are used as the key and value of the dictionary, respectively.
eg:

class ABC(object):
     def __init__(self):
         self.a = 1
         self.b = 2
         self.c = 3
     def A():
         return self.a
t = ABC()
t.__dict__
{'a': 1, 'b': 2, 'c': 3}                 
Menu