Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackingbutlegal/ab8f8b07180583aeb9360ae5cf711fdf to your computer and use it in GitHub Desktop.
Save hackingbutlegal/ab8f8b07180583aeb9360ae5cf711fdf to your computer and use it in GitHub Desktop.
import YOUR_LIBRARY_HERE
def get_methods(object, spacing=20):
methodList = []
for method_name in dir(object):
try:
if callable(getattr(object, method_name)):
methodList.append(str(method_name))
except:
methodList.append(str(method_name))
processFunc = (lambda s: ' '.join(s.split())) or (lambda s: s)
for method in methodList:
try:
print(str(method.ljust(spacing)) + ' ' +
processFunc(str(getattr(object, method).__doc__)[0:90]))
except:
print(method.ljust(spacing) + ' ' + ' getattr() failed')
get_methods(YOUR_OBJECT_HERE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment