Return a dictionary representing the local scope
Return a dictionary representing the local scope
vars([object])
returns a dictionary representing the
local scope, or a dictionary corresponding to the
attributes of the given object (do not modify the
returned dictionary).
class C(object):# from w w w. ja v a2s. co m
pass
c = C()
c.foo = 100
c.bar = 'Python'
print c.__dict__
print vars(c)
The code above generates the following result.