Class 从类中获取公共属性

Class 从类中获取公共属性,class,python-3.x,properties,public,Class,Python 3.x,Properties,Public,我想在一个字典中获得Python 3中一个类的实例的所有公共属性,使用函数public,而不需要类中函数的帮助。例如,对于以下类的实例: class Test: def __init__(self): self.a = 5 self.__b = 2 @property def c(self): return 9 def d(self): return 2 def __e(self):

我想在一个字典中获得Python 3中一个类的实例的所有公共属性,使用函数
public
,而不需要类中函数的帮助。例如,对于以下类的实例:

class Test:
    def __init__(self):
        self.a = 5
        self.__b = 2

    @property
    def c(self):
        return 9

    def d(self):
        return 2
    def __e(self):
        return 2
我想说以下几句话:

{'a': 5, 'c': 9}
提前感谢您的回复