dir(obj)
gives you all attributes of the object.
You need to filter out the members from methods etc yourself:
class Example(object):
bool143 = True
bool2 = True
blah = False
foo = True
foobar2000 = False
example = Example()
members = [attr for attr in dir(example) if not callable(getattr(example, attr)) and not attr.startswith("__")]
print members
Will give you:
['blah', 'bool143', 'bool2', 'foo', 'foobar2000']
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…