Skip to content

Instantly share code, notes, and snippets.

@kentquirk
Created March 7, 2014 18:18
Show Gist options
  • Save kentquirk/9416841 to your computer and use it in GitHub Desktop.
Save kentquirk/9416841 to your computer and use it in GitHub Desktop.
Get a list of non-callable items from an object and return their names and values
import os.path
def dumpVars(r):
apivars = [(k, type(getattr(r, k))) for k in dir(r) if not k.startswith('_') and not callable(getattr(r, k))]
values = [(k[0], getattr(r, k[0])) for k in apivars]
return values
print dumpVars(os.path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment