api helper: Print methods and doc strings,methodsstrings,def info(obj
文章由Byrx.net分享于2019-03-23 07:03:23
api helper: Print methods and doc strings,methodsstrings,def info(obj
def info(object, spacing=10, collapse=1): '''Print methods and doc strings. Takes module, class, list, dictionary, or string.''' methodList = [method for method in dir(object) if callable(getattr(object, method))] processFunc = collapse and (lambda s: ' '.join(s.split())) or (lambda s: s) print '\n'.join(['%s %s' % (method.ljust(spacing), processFunc(str(getattr(object, method).__doc__))) for method in methodList]) if __name__ == '__main__': print info.__doc__
相关内容
- A helper for analyzing PYTHONDUMPREFS output,,'''PYTHON SO
- Min function,minfunction,print min(9,
- Draw oval using Python,ovalpython,from Tkinter
- Functional Programming Tools: map: More than one sequence may be pass
- range() function with step,rangefunction,print '\n\nC
- Divide in Python,divideinpython,print '19 /
- Fibonacci sequences using generators,,'''Fibonacci
- Pass immutable and mutable value into function,immutablemutable,def
- Nest lists (create lists containing other lists),listscontaining,q
- Random integer chosen from range(6),randomchosen,import rando
评论关闭