Created
August 19, 2014 03:40
-
-
Save binzeehale/ef0d0406a661c114a1d3 to your computer and use it in GitHub Desktop.
获取python类的所有属性和值的对
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for property, value in vars(theObject).iteritems(): | |
print property, ": ", value | |
// or | |
import inspect | |
for attr, value in inspect.getmembers(obj): | |
print attr, value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment