Skip to content

Instantly share code, notes, and snippets.

@binzeehale
Created August 19, 2014 03:40
Show Gist options
  • Save binzeehale/ef0d0406a661c114a1d3 to your computer and use it in GitHub Desktop.
Save binzeehale/ef0d0406a661c114a1d3 to your computer and use it in GitHub Desktop.
获取python类的所有属性和值的对
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